]> www.git.momoyon.org Git - commonlib.git/commitdiff
[tests] Add sv_to_cstr test in string_view.c
authorahmedsamyh <ahmedsamyh10@gmail.com>
Wed, 26 Mar 2025 21:54:26 +0000 (02:54 +0500)
committerahmedsamyh <ahmedsamyh10@gmail.com>
Wed, 26 Mar 2025 21:54:26 +0000 (02:54 +0500)
tests/.string_view.out.expected
tests/string_view.c

index 6c289a1256122536b294dfdb2a4e18d0a88dc783..985535beddf1122f7f0d28803c0cfc882079b982 100644 (file)
@@ -4,3 +4,4 @@
 [INFO] mc: '/*Blah Blah
 Blah Blah2
 THis is the end'
+[INFO] cstr from sv: Hello Mister -> Hello Mister
index 38156167745df61a0b72054caa9d4924604dc546..470e2df94f2a21c43cd7c7aceb6d95f865b388bb 100644 (file)
@@ -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;
 }