From: ahmedsamyh Date: Wed, 26 Mar 2025 21:54:26 +0000 (+0500) Subject: [tests] Add sv_to_cstr test in string_view.c X-Git-Url: https://www.git.momoyon.org/?a=commitdiff_plain;h=5fcd89b868267088947a259ad466c02aca21e9ce;p=commonlib.git [tests] Add sv_to_cstr test in string_view.c --- diff --git a/tests/.string_view.out.expected b/tests/.string_view.out.expected index 6c289a1..985535b 100644 --- a/tests/.string_view.out.expected +++ b/tests/.string_view.out.expected @@ -4,3 +4,4 @@ [INFO] mc: '/*Blah Blah Blah Blah2 THis is the end' +[INFO] cstr from sv: Hello Mister -> Hello Mister diff --git a/tests/string_view.c b/tests/string_view.c index 3815616..470e2df 100644 --- a/tests/string_view.c +++ b/tests/string_view.c @@ -22,5 +22,14 @@ int main(void) { log_info("mc: '"SV_FMT"'", SV_ARG(mc)); + + String_view foo = SV("Hello Mister"); + + char *cstr = sv_to_cstr(foo); + + log_info("cstr from sv: "SV_FMT" -> %s", SV_ARG(foo), cstr); + + C_FREE(cstr); + return 0; }