Skip to content

Commit b030346

Browse files
committed
tests: internal: sds: adjust unit test for utf8
Signed-off-by: Eduardo Silva <[email protected]>
1 parent 1b6c9a1 commit b030346

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/internal/sds.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static void test_sds_printf_7143_off_by_1()
4444
flb_sds_t test;
4545
flb_sds_t test2;
4646
int len;
47-
47+
4848
/* 66 char final string, not impacted by bug */
4949
test = flb_sds_create_size(64);
5050
TEST_CHECK(test != NULL);
@@ -69,13 +69,20 @@ static void test_sds_printf_7143_off_by_1()
6969

7070
static void test_sds_cat_utf8()
7171
{
72+
int ret;
7273
flb_sds_t s;
7374
char *utf8_str = "\xe8\x9f\xb9\xf0\x9f\xa6\x80";
75+
char *expected = "\\u87f9\\ud83e\\udd80";
7476

7577
s = flb_sds_create("");
7678
flb_sds_cat_utf8(&s, utf8_str, strlen(utf8_str));
7779

78-
TEST_CHECK(strcmp(s, "\\u87f9\\u1f980") == 0);
80+
ret = strcmp(s, expected);
81+
TEST_CHECK(ret == 0);
82+
if (ret != 0) {
83+
printf("Expected: %s\n", expected);
84+
printf("Received: %s\n", s);
85+
}
7986
flb_sds_destroy(s);
8087
}
8188

0 commit comments

Comments
 (0)