summaryrefslogtreecommitdiff
path: root/tests/features/test_fstring.zc
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-18 23:23:50 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-18 23:23:50 +0000
commit82559fe7ff00f5cce030f4d5231a270267087624 (patch)
treed6571b5376ca153d46947b83ae94508de714b089 /tests/features/test_fstring.zc
parent562e010dd47ec1e238017369ea481700d826b68d (diff)
Fix for #5
Diffstat (limited to 'tests/features/test_fstring.zc')
-rw-r--r--tests/features/test_fstring.zc23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/features/test_fstring.zc b/tests/features/test_fstring.zc
new file mode 100644
index 0000000..3ef64a7
--- /dev/null
+++ b/tests/features/test_fstring.zc
@@ -0,0 +1,23 @@
+import "tests/features/fstring_mod.zc" as Mod;
+
+test "alias namespace fstring" {
+ // Tests that {Mod::get_val()} is parsed correctly (Mod_get_val)
+ var res = f"{Mod::get_val()}";
+ assert(res == "42", "Import namespace in f-string failed");
+
+ // Check local string formatting via println (compile check)
+ println "Val: {Mod::get_val()}";
+}
+
+import "tests/features/fstring_lib.h" as Lib;
+
+test "alias C header fstring" {
+ // Tests that {Lib::lib_val()} resolves to lib_val() (no mangling/prefix)
+ // parser_expr.c strips alias for C headers.
+ // parser_utils.c rewrite_expr_methods needs to do the same.
+ var res = f"{Lib::lib_val()}";
+ assert(res == "99", "C header namespace in f-string failed");
+
+ // Verify println (rewrite_expr_methods path)
+ println "C Val: {Lib::lib_val()}";
+}