commit d80b072bf29620753fb36b8053c6e81500526fb6 (tree)
parent 0804feac00ce4aff2ae746f4246d1675b6b4e491
Author: fardragon <michaldrozd@protonmail.ch>
Date: Thu, 4 Jun 2026 18:26:14 +0000
add more coverage for autoconf style
Diffstat:
5 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/test/standalone/config_header/autoconf_at/autoconf_at.txt b/test/standalone/config_header/autoconf_at/autoconf_at.txt
@@ -35,3 +35,15 @@ what is 6*7? 42!
@text@
// expanded variables are considered strings after expansion
@string@
+
+// variable name with underscores
+value
+
+// backslash before at-sigil does not prevent resolution
+\text
+
+// value that is an at-sign itself
+@
+
+// incomplete key mid-line is preserved, trailing content kept
+@incomplete trailing content
diff --git a/test/standalone/config_header/autoconf_at/autoconf_at.txt.in b/test/standalone/config_header/autoconf_at/autoconf_at.txt.in
@@ -34,3 +34,15 @@ what is 6*7? @integer@!
@@string@@
// expanded variables are considered strings after expansion
@string_at@
+
+// variable name with underscores
+@underscored_var@
+
+// backslash before at-sigil does not prevent resolution
+\@string@
+
+// value that is an at-sign itself
+@at_sign@
+
+// incomplete key mid-line is preserved, trailing content kept
+@incomplete trailing content
diff --git a/test/standalone/config_header/autoconf_undef/config.h b/test/standalone/config_header/autoconf_undef/config.h
@@ -20,4 +20,15 @@ int foo();
/* #undef PREFIX_TAB */
/* #undef POSTFIX_SPACE */
/* #undef POSTFIX_TAB */
+
+// #undef with underscored variable name
+#define SOME_UNDERSCORED 1
+
+// #undef with extra tokens after variable name (ignored)
+#define SOME_ONE 1
+
+// non-#undef # lines pass through unchanged
+#define KEPT_DEFINE value
+#include <kept.h>
// TODO: unexpected newline is being added here
+
diff --git a/test/standalone/config_header/autoconf_undef/config.h.in b/test/standalone/config_header/autoconf_undef/config.h.in
@@ -17,6 +17,16 @@ int foo();
#undef PREFIX_SPACE
#undef PREFIX_TAB
-#undef POSTFIX_SPACE
-#undef POSTFIX_TAB
-// TODO: unexpected newline is being added here
-\ No newline at end of file
+#undef POSTFIX_SPACE
+#undef POSTFIX_TAB
+
+// #undef with underscored variable name
+#undef SOME_UNDERSCORED
+
+// #undef with extra tokens after variable name (ignored)
+#undef SOME_ONE extra ignored tokens
+
+// non-#undef # lines pass through unchanged
+#define KEPT_DEFINE value
+#include <kept.h>
+// TODO: unexpected newline is being added here
diff --git a/test/standalone/config_header/build.zig b/test/standalone/config_header/build.zig
@@ -21,6 +21,8 @@ pub fn build(b: *std.Build) void {
.PREFIX_TAB = null,
.POSTFIX_SPACE = null,
.POSTFIX_TAB = null,
+
+ .SOME_UNDERSCORED = true,
},
);
const check_config_header = b.addCheckFile(config_header.getOutputFile(), .{
@@ -37,6 +39,9 @@ pub fn build(b: *std.Build) void {
.integer = 42,
.string = "text",
.string_at = "@string@",
+
+ .underscored_var = "value",
+ .at_sign = "@",
},
);
const check_config_header_autoconf_at = b.addCheckFile(config_header_autoconf_at.getOutputFile(), .{