tests: add bt_field_string_clear test
Add a test for bt_field_string_clear, exercising the fix done in commit
0022a87819b0 ("Fix: clear_string_field(): set first character to 0").
The test sets the field to a non-empty value, clears it with
bt_field_string_clear, and verifies that the value returned by
bt_field_string_get_value is an empty string, and that the length
returned by bt_field_string_get_length is 0.
When reverting
0022a87819b0, the test gives:
1..2
not ok 1 - string field is empty
# Failed test (/home/smarchi/src/babeltrace/tests/lib/test_fields.cpp:operator()() at line 36)
ok 2 - string field length is 0
# Looks like you failed 1 test of 2.
Change-Id: I46800a93a7290fe72618081efdc5cdcd944c8567
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10068
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>