authorgravatar for michaldrozd@protonmail.chfardragon <michaldrozd@protonmail.ch> 2026-06-04 18:26:14+00:00
committergravatar for michaldrozd@protonmail.chfardragon <michaldrozd@protonmail.ch> 2026-06-05 14:59:18+02:00
logd80b072bf29620753fb36b8053c6e81500526fb6
treedb6ec7ef2db9628dea49875dedecd7c81cdac399
parent0804feac00ce4aff2ae746f4246d1675b6b4e491

add more coverage for autoconf style


5 files changed, 53 insertions(+), 3 deletions(-)

test/standalone/config_header/autoconf_at/autoconf_at.txt+12
...@@ -35,3 +35,15 @@ what is 6*7? 42!...@@ -35,3 +35,15 @@ what is 6*7? 42!
35@text@35@text@
36// expanded variables are considered strings after expansion36// expanded variables are considered strings after expansion
37@string@37@string@
38
39// variable name with underscores
40value
41
42// backslash before at-sigil does not prevent resolution
43\text
44
45// value that is an at-sign itself
46@
47
48// incomplete key mid-line is preserved, trailing content kept
49@incomplete trailing content
test/standalone/config_header/autoconf_at/autoconf_at.txt.in+12
...@@ -34,3 +34,15 @@ what is 6*7? @integer@!...@@ -34,3 +34,15 @@ what is 6*7? @integer@!
34@@string@@34@@string@@
35// expanded variables are considered strings after expansion35// expanded variables are considered strings after expansion
36@string_at@36@string_at@
37
38// variable name with underscores
39@underscored_var@
40
41// backslash before at-sigil does not prevent resolution
42\@string@
43
44// value that is an at-sign itself
45@at_sign@
46
47// incomplete key mid-line is preserved, trailing content kept
48@incomplete trailing content
test/standalone/config_header/autoconf_undef/config.h+11
...@@ -20,4 +20,15 @@ int foo();...@@ -20,4 +20,15 @@ int foo();
20/* #undef PREFIX_TAB */20/* #undef PREFIX_TAB */
21/* #undef POSTFIX_SPACE */21/* #undef POSTFIX_SPACE */
22/* #undef POSTFIX_TAB */22/* #undef POSTFIX_TAB */
23
24// #undef with underscored variable name
25#define SOME_UNDERSCORED 1
26
27// #undef with extra tokens after variable name (ignored)
28#define SOME_ONE 1
29
30// non-#undef # lines pass through unchanged
31#define KEPT_DEFINE value
32#include <kept.h>
23// TODO: unexpected newline is being added here33// TODO: unexpected newline is being added here
34
test/standalone/config_header/autoconf_undef/config.h.in+13-3
...@@ -17,6 +17,16 @@ int foo();...@@ -17,6 +17,16 @@ int foo();
1717
18#undef PREFIX_SPACE18#undef PREFIX_SPACE
19#undef PREFIX_TAB19#undef PREFIX_TAB
20#undef POSTFIX_SPACE
21#undef POSTFIX_TAB
22// TODO: unexpected newline is being added here
\ No newline at end of file
20#undef POSTFIX_SPACE
21#undef POSTFIX_TAB
22
23// #undef with underscored variable name
24#undef SOME_UNDERSCORED
25
26// #undef with extra tokens after variable name (ignored)
27#undef SOME_ONE extra ignored tokens
28
29// non-#undef # lines pass through unchanged
30#define KEPT_DEFINE value
31#include <kept.h>
32// TODO: unexpected newline is being added here
test/standalone/config_header/build.zig+5
...@@ -21,6 +21,8 @@ pub fn build(b: *std.Build) void {...@@ -21,6 +21,8 @@ pub fn build(b: *std.Build) void {
21 .PREFIX_TAB = null,21 .PREFIX_TAB = null,
22 .POSTFIX_SPACE = null,22 .POSTFIX_SPACE = null,
23 .POSTFIX_TAB = null,23 .POSTFIX_TAB = null,
24
25 .SOME_UNDERSCORED = true,
24 },26 },
25 );27 );
26 const check_config_header = b.addCheckFile(config_header.getOutputFile(), .{28 const check_config_header = b.addCheckFile(config_header.getOutputFile(), .{
...@@ -37,6 +39,9 @@ pub fn build(b: *std.Build) void {...@@ -37,6 +39,9 @@ pub fn build(b: *std.Build) void {
37 .integer = 42,39 .integer = 42,
38 .string = "text",40 .string = "text",
39 .string_at = "@string@",41 .string_at = "@string@",
42
43 .underscored_var = "value",
44 .at_sign = "@",
40 },45 },
41 );46 );
42 const check_config_header_autoconf_at = b.addCheckFile(config_header_autoconf_at.getOutputFile(), .{47 const check_config_header_autoconf_at = b.addCheckFile(config_header_autoconf_at.getOutputFile(), .{