authorgravatar for michaldrozd@protonmail.chfardragon <michaldrozd@protonmail.ch> 2026-06-04 17:37:11+00:00
committergravatar for michaldrozd@protonmail.chfardragon <michaldrozd@protonmail.ch> 2026-06-05 14:59:18+02:00
log0804feac00ce4aff2ae746f4246d1675b6b4e491
tree07f59fb2f9281af16628c730d11fc208b499e239
parent59bd8201dc0f5ed31146ae2c9cff06b89e94cfc8

Deduplicate and cleanup cmake tests


20 files changed, 464 insertions(+), 636 deletions(-)

test/standalone/config_header/build.zig+53-104
...@@ -5,9 +5,7 @@ pub fn build(b: *std.Build) void {...@@ -5,9 +5,7 @@ pub fn build(b: *std.Build) void {
5 b.default_step = test_step;5 b.default_step = test_step;
66
7 const config_header = b.addConfigHeader(7 const config_header = b.addConfigHeader(
8 .{ .style = .{8 .{ .style = .{ .autoconf_undef = b.path("autoconf_undef/config.h.in") } },
9 .autoconf_undef = b.path("autoconf_undef/config.h.in"),
10 } },
11 .{9 .{
12 .SOME_NO = null,10 .SOME_NO = null,
13 .SOME_TRUE = true,11 .SOME_TRUE = true,
...@@ -30,9 +28,7 @@ pub fn build(b: *std.Build) void {...@@ -30,9 +28,7 @@ pub fn build(b: *std.Build) void {
30 });28 });
3129
32 const config_header_autoconf_at = b.addConfigHeader(30 const config_header_autoconf_at = b.addConfigHeader(
33 .{ .style = .{31 .{ .style = .{ .autoconf_at = b.path("autoconf_at/autoconf_at.txt.in") } },
34 .autoconf_at = b.path("autoconf_at/autoconf_at.txt.in"),
35 } },
36 .{32 .{
37 .undefined = null,33 .undefined = null,
38 .defined = {},34 .defined = {},
...@@ -54,132 +50,85 @@ pub fn build(b: *std.Build) void {...@@ -54,132 +50,85 @@ pub fn build(b: *std.Build) void {
5450
55fn addCmakeChecks(b: *std.Build, test_step: *std.Build.Step) void {51fn addCmakeChecks(b: *std.Build, test_step: *std.Build.Step) void {
56 const config_header = b.addConfigHeader(52 const config_header = b.addConfigHeader(
53 .{ .style = .{ .cmake = b.path("cmake/config.h.in") } },
57 .{54 .{
58 .style = .{ .cmake = b.path("cmake/config.h.in") },55 .NOVAL = null,
59 .include_path = "config.h",56 .TRUEVAL = true,
60 },57 .FALSEVAL = false,
61 .{58 .ZEROVAL = 0,
62 .noval = null,59 .ONEVAL = 1,
63 .trueval = true,60 .TENVAL = 10,
64 .falseval = false,61 .STRINGVAL = "test",
65 .zeroval = 0,
66 .oneval = 1,
67 .tenval = 10,
68 .stringval = "test",
6962
70 .boolnoval = {},63 .BOOLNOVAL = {},
71 .booltrueval = true,64 .BOOLTRUEVAL = true,
72 .boolfalseval = false,65 .BOOLFALSEVAL = false,
73 .boolzeroval = 0,66 .BOOLZEROVAL = 0,
74 .booloneval = 1,67 .BOOLONEVAL = 1,
75 .booltenval = 10,68 .BOOLTENVAL = 10,
76 .boolstringval = "test",69 .BOOLSTRINGVAL = "test",
77 },70 },
78 );71 );
79 const check_config_header = b.addCheckFile(config_header.getOutputFile(), .{72 const check_config_header = b.addCheckFile(config_header.getOutputFile(), .{
80 .expected_exact = @embedFile("cmake/expected_config.h"),73 .expected_exact = @embedFile("cmake/config.h"),
81 });74 });
82 test_step.dependOn(&check_config_header.step);75 test_step.dependOn(&check_config_header.step);
8376
84 const pwd_sh = b.addConfigHeader(77 const pwd_sh = b.addConfigHeader(
85 .{78 .{ .style = .{ .cmake = b.path("cmake/pwd.sh.in") } },
86 .style = .{ .cmake = b.path("cmake/pwd.sh.in") },
87 .include_path = "pwd.sh",
88 },
89 .{ .DIR = "${PWD}" },79 .{ .DIR = "${PWD}" },
90 );80 );
91 const check_pwd_sh = b.addCheckFile(pwd_sh.getOutputFile(), .{81 const check_pwd_sh = b.addCheckFile(pwd_sh.getOutputFile(), .{
92 .expected_exact = @embedFile("cmake/expected_pwd.sh"),82 .expected_exact = @embedFile("cmake/pwd.sh"),
93 });83 });
94 test_step.dependOn(&check_pwd_sh.step);84 test_step.dependOn(&check_pwd_sh.step);
9585
96 const sigil_header = b.addConfigHeader(86 const config_header_edge_cases = b.addConfigHeader(
97 .{87 .{ .style = .{ .cmake = b.path("cmake/edge_cases.h.in") } },
98 .style = .{ .cmake = b.path("cmake/sigil.h.in") },
99 .include_path = "sigil.h",
100 },
101 .{},
102 );
103 const check_sigil_header = b.addCheckFile(sigil_header.getOutputFile(), .{
104 .expected_exact = @embedFile("cmake/expected_sigil.h"),
105 });
106 test_step.dependOn(&check_sigil_header.step);
107
108 const stack_header = b.addConfigHeader(
109 .{
110 .style = .{ .cmake = b.path("cmake/stack.h.in") },
111 .include_path = "stack.h",
112 },
113 .{
114 .UNDERSCORE = "_",
115 .NEST_UNDERSCORE_PROXY = "UNDERSCORE",
116 .NEST_PROXY = "NEST_UNDERSCORE_PROXY",
117 },
118 );
119 const check_stack_header = b.addCheckFile(stack_header.getOutputFile(), .{
120 .expected_exact = @embedFile("cmake/expected_stack.h"),
121 });
122 test_step.dependOn(&check_stack_header.step);
123
124 const wrapper_header = b.addConfigHeader(
125 .{
126 .style = .{ .cmake = b.path("cmake/wrapper.h.in") },
127 .include_path = "wrapper.h",
128 },
129 .{88 .{
130 .DOLLAR = "$",89 .DOLLAR = "$",
131 .TEXT = "TRAP",90 .UNDERSCORE = "_",
13291 .STRING = "text",
133 .STRING = "TEXT",92 .STRING_PROXY = "STRING",
134 .STRING_AT = "@STRING@",93 .STRING_AT = "@STRING@",
135 .STRING_CURLY = "{STRING}",94 .STRING_CURLY = "{STRING}",
136 .STRING_VAR = "${STRING}",95 .STRING_VAR = "${STRING}",
96 .NEST_UNDERSCORE_PROXY = "UNDERSCORE",
97 .NEST_PROXY = "NEST_UNDERSCORE_PROXY",
137 },98 },
138 );99 );
139 const check_wrapper_header = b.addCheckFile(wrapper_header.getOutputFile(), .{100 const check_config_header_edge_cases = b.addCheckFile(config_header_edge_cases.getOutputFile(), .{
140 .expected_exact = @embedFile("cmake/expected_wrapper.h"),101 .expected_exact = @embedFile("cmake/edge_cases.h"),
141 });102 });
142 test_step.dependOn(&check_wrapper_header.step);103 test_step.dependOn(&check_config_header_edge_cases.step);
143104
144 const config_header_cmake = b.addConfigHeader(105 const config_header_cmakedefine_edge_cases = b.addConfigHeader(
145 .{ .style = .{
146 .cmake = b.path("cmake/cmake.txt.in"),
147 } },
148 .{106 .{
149 .undef = null,107 .style = .{ .cmake = b.path("cmake/cmakedefine_edge_cases.h.in") },
150 .defined = {},108 .include_path = "cmakedefine_edge_cases_renamed.h",
151 .true = true,
152 .false = false,
153 .int = 42,
154 .ident = "value",
155 .string = "text",
156 },109 },
157 );
158 const check_config_header_cmake = b.addCheckFile(config_header_cmake.getOutputFile(), .{
159 .expected_exact = @embedFile("cmake/cmake.txt"),
160 });
161 test_step.dependOn(&check_config_header_cmake.step);
162
163 const config_header_cmake_edge_cases = b.addConfigHeader(
164 .{ .style = .{
165 .cmake = b.path("cmake/cmake_edge_cases.txt.in"),
166 } },
167 .{110 .{
168 // .at = "@",111 .MULTI_WORD = true,
169 // .trueval = true,112 .MULTI_WORD_FALSE = false,
170 .dollar = "$",113 .NO_VALUE = true,
171 .underscore = "_",114 .NO_VALUE_FALSE = false,
172 .string = "text",115 .WITH_UNDERSCORE_TRUE = true,
173 .string_proxy = "string",116 .WITH_UNDERSCORE_FALSE = false,
174 .string_at = "@string@",117 ._LEADING = true,
175 .string_curly = "{string}",118 .TRAILING_ = true,
176 .string_var = "${string}",119 ._UNDER_01 = true,
177 .nest_underscore_proxy = "underscore",120 .UNDER_01_ = true,
178 .nest_proxy = "nest_underscore_proxy",121 .SUBST_VAL = true,
122 .SUBST_VAL_FALSE = false,
123 .STRING = "text",
124 .VAR_NAME = "ACTUAL_VAR",
125 .ACTUAL_VAR = true,
126 .AT_SIGN = "@",
127 .DOLLAR_SIGN = "$",
179 },128 },
180 );129 );
181 const check_config_header_cmake_edge_cases = b.addCheckFile(config_header_cmake_edge_cases.getOutputFile(), .{130 const check_config_header_cmakedefine_edge_cases = b.addCheckFile(config_header_cmakedefine_edge_cases.getOutputFile(), .{
182 .expected_exact = @embedFile("cmake/cmake_edge_cases.txt"),131 .expected_exact = @embedFile("cmake/cmakedefine_edge_cases.h"),
183 });132 });
184 test_step.dependOn(&check_config_header_cmake_edge_cases.step);133 test_step.dependOn(&check_config_header_cmakedefine_edge_cases.step);
185}134}
test/standalone/config_header/cmake/cmake.txt deleted-66
...@@ -1,66 +0,0 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2// empty strings are preserved
3
4// line with misc content is preserved
5no substitution
6
7// empty @ sigils are preserved
8@
9@@
10@@@
11@@@@
12
13// simple substitution
14
15
16
17
181
191
200
210
2242
2342
24value
25value
26text
27text
28
29// double packed substitution
30texttext
31texttext
32
33// triple packed substitution
34text42text
35text42text
36text42text
37text42text
38
39// double separated substitution
4042.42
4142.42
42
43// triple separated substitution
4442.1.42
4542.1.42
4642.1.42
4742.1.42
48
49// misc prefix is preserved
50false is 0
51false is 0
52
53// misc suffix is preserved
541 is true
551 is true
56
57// surrounding content is preserved
58what is 6*7? 42!
59what is 6*7? 42!
60
61// incomplete key is preserved
62@undef
63${undef
64{undef}
65undef@
66undef}
test/standalone/config_header/cmake/cmake.txt.in deleted-65
...@@ -1,65 +0,0 @@
1// empty strings are preserved
2
3// line with misc content is preserved
4no substitution
5
6// empty @ sigils are preserved
7@
8@@
9@@@
10@@@@
11
12// simple substitution
13@undef@
14${undef}
15@defined@
16${defined}
17@true@
18${true}
19@false@
20${false}
21@int@
22${int}
23@ident@
24${ident}
25@string@
26${string}
27
28// double packed substitution
29@string@@string@
30${string}${string}
31
32// triple packed substitution
33@string@@int@@string@
34@string@${int}@string@
35${string}@int@${string}
36${string}${int}${string}
37
38// double separated substitution
39@int@.@int@
40${int}.${int}
41
42// triple separated substitution
43@int@.@true@.@int@
44@int@.${true}.@int@
45${int}.@true@.${int}
46${int}.${true}.${int}
47
48// misc prefix is preserved
49false is @false@
50false is ${false}
51
52// misc suffix is preserved
53@true@ is true
54${true} is true
55
56// surrounding content is preserved
57what is 6*7? @int@!
58what is 6*7? ${int}!
59
60// incomplete key is preserved
61@undef
62${undef
63{undef}
64undef@
65undef}
test/standalone/config_header/cmake/cmake_edge_cases.txt deleted-38
...@@ -1,38 +0,0 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2// empty lines are preserved
3
4// @-substition tests
5// @-vars resolved only when they wrap valid characters, otherwise considered literals
6@text@
7@text@
8
9// at-vars are resolved inside curly-vars
10text
11
12// expanded variables are considered strings after expansion
13@string@
14@string@
15${string}
16${string}
17${string}
18${string}
19${text}
20${text}
21${text}
22
23// nested expanded variables are expanded from the inside out
24string
25string
26
27// nested vars are only expanded when curly braces are closed
28nest_underscore_proxy
29nest_underscore_proxy
30
31// backslash is an invalid character for @ lookup
32\@string\@
33
34// backslash is preserved, but doesn't affect $curly-braces variable expansion
35\text
36
37// backslash breaks $curly-braces opening bracket identification
38$\{string}
test/standalone/config_header/cmake/cmake_edge_cases.txt.in deleted-37
...@@ -1,37 +0,0 @@
1// empty lines are preserved
2
3// @-substition tests
4// @-vars resolved only when they wrap valid characters, otherwise considered literals
5@@string@@
6@${string}@
7
8// at-vars are resolved inside curly-vars
9${@string_proxy@}
10
11// expanded variables are considered strings after expansion
12@string_at@
13${string_at}
14$@string_curly@
15$${string_curly}
16${string_var}
17@string_var@
18${dollar}{${string}}
19@dollar@{${string}}
20@dollar@{@string@}
21
22// nested expanded variables are expanded from the inside out
23${string${underscore}proxy}
24${string@underscore@proxy}
25
26// nested vars are only expanded when curly braces are closed
27${nest${underscore}proxy}
28${nest${${nest_underscore${underscore}proxy}}proxy}
29
30// backslash is an invalid character for @ lookup
31\@string\@
32
33// backslash is preserved, but doesn't affect $curly-braces variable expansion
34\${string}
35
36// backslash breaks $curly-braces opening bracket identification
37$\{string}
test/standalone/config_header/cmake/cmakedefine_edge_cases.h created+43
...@@ -0,0 +1,43 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2// cmakedefine with multi-word string value (truthy)
3#define MULTI_WORD "hello world"
4
5// cmakedefine with multi-word string value (falsy)
6/* #undef MULTI_WORD_FALSE */
7
8// cmakedefine with no replacement value (truthy)
9// TODO: unexpected whitespace is being added here
10#define NO_VALUE
11
12// cmakedefine with no replacement value (falsy)
13/* #undef NO_VALUE_FALSE */
14
15// cmakedefine01 with underscored variable names (truthy)
16#define WITH_UNDERSCORE_TRUE 1
17
18// cmakedefine01 with underscored variable names (falsy)
19#define WITH_UNDERSCORE_FALSE 0
20
21// cmakedefine with leading/trailing underscores (truthy)
22#define _LEADING 1
23#define TRAILING_ 1
24
25// cmakedefine01 with leading/trailing underscores (truthy)
26#define _UNDER_01 1
27#define UNDER_01_ 1
28
29// cmakedefine with @ substitution in the replacement value (truthy)
30#define SUBST_VAL text
31
32// cmakedefine with @ substitution in the replacement value (falsy)
33/* #undef SUBST_VAL_FALSE */
34
35// cmakedefine with @ substitution as the variable name
36#define ACTUAL_VAR custom_val
37
38// cmakedefine with dollar-curly substitution as the variable name
39#define ACTUAL_VAR custom_val
40
41// @ and $ as literal config values
42@
43$
test/standalone/config_header/cmake/cmakedefine_edge_cases.h.in created+42
...@@ -0,0 +1,42 @@
1// cmakedefine with multi-word string value (truthy)
2#cmakedefine MULTI_WORD "hello world"
3
4// cmakedefine with multi-word string value (falsy)
5#cmakedefine MULTI_WORD_FALSE "hello world"
6
7// cmakedefine with no replacement value (truthy)
8// TODO: unexpected whitespace is being added here
9#cmakedefine NO_VALUE
10
11// cmakedefine with no replacement value (falsy)
12#cmakedefine NO_VALUE_FALSE
13
14// cmakedefine01 with underscored variable names (truthy)
15#cmakedefine01 WITH_UNDERSCORE_TRUE
16
17// cmakedefine01 with underscored variable names (falsy)
18#cmakedefine01 WITH_UNDERSCORE_FALSE
19
20// cmakedefine with leading/trailing underscores (truthy)
21#cmakedefine _LEADING 1
22#cmakedefine TRAILING_ 1
23
24// cmakedefine01 with leading/trailing underscores (truthy)
25#cmakedefine01 _UNDER_01
26#cmakedefine01 UNDER_01_
27
28// cmakedefine with @ substitution in the replacement value (truthy)
29#cmakedefine SUBST_VAL @STRING@
30
31// cmakedefine with @ substitution in the replacement value (falsy)
32#cmakedefine SUBST_VAL_FALSE @STRING@
33
34// cmakedefine with @ substitution as the variable name
35#cmakedefine @VAR_NAME@ custom_val
36
37// cmakedefine with dollar-curly substitution as the variable name
38#cmakedefine ${VAR_NAME} custom_val
39
40// @ and $ as literal config values
41@AT_SIGN@
42${DOLLAR_SIGN}
test/standalone/config_header/cmake/config.h created+144
...@@ -0,0 +1,144 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2// cmakedefine — value is null (undefined) → /* #undef */
3/* #undef NOVAL */
4
5// cmakedefine — value is true → #define ... 1
6#define TRUEVAL 1
7
8// cmakedefine — value is false → /* #undef */
9/* #undef FALSEVAL */
10
11// cmakedefine — value is 0 (falsy) → /* #undef */
12/* #undef ZEROVAL */
13
14// cmakedefine — value is 1 (truthy) → #define ... 1
15#define ONEVAL 1
16
17// cmakedefine — value is 10 (truthy) → #define ... 1
18#define TENVAL 1
19
20// cmakedefine — value is non-empty string (truthy) → #define ... 1
21#define STRINGVAL 1
22
23// cmakedefine — leading whitespace preserved in output
24 #define STRINGVAL 1
25 #define STRINGVAL 1
26
27
28// cmakedefine01 — value is {} (defined, no value) → 0
29#define BOOLNOVAL 0
30
31// cmakedefine01 — value is true → 1
32#define BOOLTRUEVAL 1
33
34// cmakedefine01 — value is false → 0
35#define BOOLFALSEVAL 0
36
37// cmakedefine01 — value is 0 (falsy) → 0
38#define BOOLZEROVAL 0
39
40// cmakedefine01 — value is 1 (truthy) → 1
41#define BOOLONEVAL 1
42
43// cmakedefine01 — value is 10 (truthy) → 1
44#define BOOLTENVAL 1
45
46// cmakedefine01 — value is non-empty string (truthy) → 1
47#define BOOLSTRINGVAL 1
48
49
50// @-substitution — value is null → empty string
51//
52
53// @-substitution — null values produce nothing even when packed
54//
55
56// @-substitution — null values produce nothing even when separated
57// .
58
59// @-substitution — value is true → "1"
60// 1
61
62// @-substitution — value is false → "0"
63// 0
64
65// @-substitution — true + false packed → "10"
66// 10
67
68// @-substitution — false + true separated → "0.1"
69// 0.1
70
71// @-substitution — value is 0 → "0"
72// 0
73
74// @-substitution — value is 1 → "1"
75// 1
76
77// @-substitution — value is 10 → "10"
78// 10
79
80// @-substitution — 0 + 1 packed → "01"
81// 01
82
83// @-substitution — 0 + 10 separated → "0.10"
84// 0.10
85
86// @-substitution — value is string "test" → "test"
87// test
88
89// @-substitution — strings packed → "testtest"
90// testtest
91
92// @-substitution — strings separated → "test.test"
93// test.test
94
95// @-substitution — mixed null/string/true/zero → "test10"
96// test10
97
98// dollar-curly substitution — value is null → empty string
99//
100
101// dollar-curly substitution — null values produce nothing even when packed
102//
103
104// dollar-curly substitution — null values produce nothing even when separated
105// .
106
107// dollar-curly substitution — value is true → "1"
108// 1
109
110// dollar-curly substitution — value is false → "0"
111// 0
112
113// dollar-curly substitution — true + false packed → "10"
114// 10
115
116// dollar-curly substitution — false + true separated → "0.1"
117// 0.1
118
119// dollar-curly substitution — value is 0 → "0"
120// 0
121
122// dollar-curly substitution — value is 1 → "1"
123// 1
124
125// dollar-curly substitution — value is 10 → "10"
126// 10
127
128// dollar-curly substitution — 0 + 1 packed → "01"
129// 01
130
131// dollar-curly substitution — 0 + 10 separated → "0.10"
132// 0.10
133
134// dollar-curly substitution — value is string "test" → "test"
135// test
136
137// dollar-curly substitution — strings packed → "testtest"
138// testtest
139
140// dollar-curly substitution — strings separated → "test.test"
141// test.test
142
143// dollar-curly substitution — mixed null/string/true/zero → "test10"
144// test10
test/standalone/config_header/cmake/config.h.in+95-99
...@@ -1,147 +1,143 @@...@@ -1,147 +1,143 @@
1// cmakedefine1// cmakedefine — value is null (undefined) → /* #undef */
2// undefined2#cmakedefine NOVAL unreachable
3#cmakedefine noval unreachable
43
5// 14// cmakedefine — value is true → #define ... 1
6#cmakedefine trueval 15#cmakedefine TRUEVAL 1
76
8// undefined7// cmakedefine — value is false → /* #undef */
9#cmakedefine falseval unreachable8#cmakedefine FALSEVAL unreachable
109
11// undefined10// cmakedefine — value is 0 (falsy) → /* #undef */
12#cmakedefine zeroval unreachable11#cmakedefine ZEROVAL unreachable
1312
14// 113// cmakedefine — value is 1 (truthy) → #define ... 1
15#cmakedefine oneval 114#cmakedefine ONEVAL 1
1615
17// 116// cmakedefine — value is 10 (truthy) → #define ... 1
18#cmakedefine tenval 117#cmakedefine TENVAL 1
1918
20// 119// cmakedefine — value is non-empty string (truthy) → #define ... 1
21#cmakedefine stringval 120#cmakedefine STRINGVAL 1
2221
23// whitespace test22// cmakedefine — leading whitespace preserved in output
24 #cmakedefine stringval 123 #cmakedefine STRINGVAL 1
25 #cmakedefine stringval 124 #cmakedefine STRINGVAL 1
2625
2726
28// cmakedefine0127// cmakedefine01 — value is {} (defined, no value) → 0
29// 028#cmakedefine01 BOOLNOVAL
30#cmakedefine01 boolnoval
3129
32// 130// cmakedefine01 — value is true → 1
33#cmakedefine01 booltrueval31#cmakedefine01 BOOLTRUEVAL
3432
35// 033// cmakedefine01 — value is false → 0
36#cmakedefine01 boolfalseval34#cmakedefine01 BOOLFALSEVAL
3735
38// 036// cmakedefine01 — value is 0 (falsy) → 0
39#cmakedefine01 boolzeroval37#cmakedefine01 BOOLZEROVAL
4038
41// 139// cmakedefine01 — value is 1 (truthy) → 1
42#cmakedefine01 booloneval40#cmakedefine01 BOOLONEVAL
4341
44// 142// cmakedefine01 — value is 10 (truthy) → 1
45#cmakedefine01 booltenval43#cmakedefine01 BOOLTENVAL
4644
47// 145// cmakedefine01 — value is non-empty string (truthy) → 1
48#cmakedefine01 boolstringval46#cmakedefine01 BOOLSTRINGVAL
4947
5048
51// @ substition49// @-substitution — value is null → empty string
50// @NOVAL@
5251
53// no substition52// @-substitution — null values produce nothing even when packed
54// @noval@53// @NOVAL@@NOVAL@
5554
56// no substition55// @-substitution — null values produce nothing even when separated
57// @noval@@noval@56// @NOVAL@.@NOVAL@
5857
59// no substition58// @-substitution — value is true → "1"
60// @noval@.@noval@59// @TRUEVAL@
6160
62// 161// @-substitution — value is false → "0"
63// @trueval@62// @FALSEVAL@
6463
65// 064// @-substitution — true + false packed → "10"
66// @falseval@65// @TRUEVAL@@FALSEVAL@
6766
68// 1067// @-substitution — false + true separated → "0.1"
69// @trueval@@falseval@68// @FALSEVAL@.@TRUEVAL@
7069
71// 0.170// @-substitution — value is 0 → "0"
72// @falseval@.@trueval@71// @ZEROVAL@
7372
74// 073// @-substitution — value is 1 → "1"
75// @zeroval@74// @ONEVAL@
7675
77// 176// @-substitution — value is 10 → "10"
78// @oneval@77// @TENVAL@
7978
80// 1079// @-substitution — 0 + 1 packed → "01"
81// @tenval@80// @ZEROVAL@@ONEVAL@
8281
83// 0182// @-substitution — 0 + 10 separated → "0.10"
84// @zeroval@@oneval@83// @ZEROVAL@.@TENVAL@
8584
86// 0.1085// @-substitution — value is string "test" → "test"
87// @zeroval@.@tenval@86// @STRINGVAL@
8887
89// test88// @-substitution — strings packed → "testtest"
90// @stringval@89// @STRINGVAL@@STRINGVAL@
9190
92// testtest91// @-substitution — strings separated → "test.test"
93// @stringval@@stringval@92// @STRINGVAL@.@STRINGVAL@
9493
95// test.test94// @-substitution — mixed null/string/true/zero → "test10"
96// @stringval@.@stringval@95// @NOVAL@@STRINGVAL@@TRUEVAL@@ZEROVAL@
9796
98// test1097// dollar-curly substitution — value is null → empty string
99// @noval@@stringval@@trueval@@zeroval@98// ${NOVAL}
10099
101// no substition100// dollar-curly substitution — null values produce nothing even when packed
102// ${noval}101// ${NOVAL}${NOVAL}
103102
104// no substition103// dollar-curly substitution — null values produce nothing even when separated
105// ${noval}${noval}104// ${NOVAL}.${NOVAL}
106105
107// no substition106// dollar-curly substitution — value is true → "1"
108// ${noval}.${noval}107// ${TRUEVAL}
109108
110// 1109// dollar-curly substitution — value is false → "0"
111// ${trueval}110// ${FALSEVAL}
112111
113// 0112// dollar-curly substitution — true + false packed → "10"
114// ${falseval}113// ${TRUEVAL}${FALSEVAL}
115114
116// 10115// dollar-curly substitution — false + true separated → "0.1"
117// ${trueval}${falseval}116// ${FALSEVAL}.${TRUEVAL}
118117
119// 0.1118// dollar-curly substitution — value is 0 → "0"
120// ${falseval}.${trueval}119// ${ZEROVAL}
121120
122// 0121// dollar-curly substitution — value is 1 → "1"
123// ${zeroval}122// ${ONEVAL}
124123
125// 1124// dollar-curly substitution — value is 10 → "10"
126// ${oneval}125// ${TENVAL}
127126
128// 10127// dollar-curly substitution — 0 + 1 packed → "01"
129// ${tenval}128// ${ZEROVAL}${ONEVAL}
130129
131// 01130// dollar-curly substitution — 0 + 10 separated → "0.10"
132// ${zeroval}${oneval}131// ${ZEROVAL}.${TENVAL}
133132
134// 0.10133// dollar-curly substitution — value is string "test" → "test"
135// ${zeroval}.${tenval}134// ${STRINGVAL}
136135
137// test136// dollar-curly substitution — strings packed → "testtest"
138// ${stringval}137// ${STRINGVAL}${STRINGVAL}
139138
140// testtest139// dollar-curly substitution — strings separated → "test.test"
141// ${stringval}${stringval}140// ${STRINGVAL}.${STRINGVAL}
142141
143// test.test142// dollar-curly substitution — mixed null/string/true/zero → "test10"
144// ${stringval}.${stringval}143// ${NOVAL}${STRINGVAL}${TRUEVAL}${ZEROVAL}
145
146// test10
147// ${noval}${stringval}${trueval}${zeroval}
test/standalone/config_header/cmake/edge_cases.h created+43
...@@ -0,0 +1,43 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2// empty lines are preserved
3
4// double-wrapped at-sigils work like single-wrapped
5@text@
6@text@
7
8// at-var lookup happens inside dollar-curly before dollar-curly lookup
9text
10
11// expanded variables are treated as strings and can be re-substituted
12@STRING@
13@STRING@
14${STRING}
15${STRING}
16${STRING}
17${STRING}
18${text}
19${text}
20${text}
21
22// nested dollar-curly expansion from the inside out
23STRING
24STRING
25
26// nested dollar-curly — only completed brace blocks are expanded
27NEST_UNDERSCORE_PROXY
28NEST_UNDERSCORE_PROXY
29
30// backslash is invalid in at-var names — preserved as literal
31\@STRING\@
32
33// backslash does not affect dollar-curly expansion
34\text
35
36// backslash before opening brace breaks dollar-curly identification
37$\{STRING}
38
39// bare at-sigils pass through unchanged with no variable map
40#define AT @
41#define ATAT @@
42#define ATATAT @@@
43#define ATATATAT @@@@
test/standalone/config_header/cmake/edge_cases.h.in created+42
...@@ -0,0 +1,42 @@
1// empty lines are preserved
2
3// double-wrapped at-sigils work like single-wrapped
4@@STRING@@
5@${STRING}@
6
7// at-var lookup happens inside dollar-curly before dollar-curly lookup
8${@STRING_PROXY@}
9
10// expanded variables are treated as strings and can be re-substituted
11@STRING_AT@
12${STRING_AT}
13$@STRING_CURLY@
14$${STRING_CURLY}
15${STRING_VAR}
16@STRING_VAR@
17${DOLLAR}{${STRING}}
18@DOLLAR@{${STRING}}
19@DOLLAR@{@STRING@}
20
21// nested dollar-curly expansion from the inside out
22${STRING${UNDERSCORE}PROXY}
23${STRING@UNDERSCORE@PROXY}
24
25// nested dollar-curly — only completed brace blocks are expanded
26${NEST${UNDERSCORE}PROXY}
27${NEST${${NEST_UNDERSCORE${UNDERSCORE}PROXY}}PROXY}
28
29// backslash is invalid in at-var names — preserved as literal
30\@STRING\@
31
32// backslash does not affect dollar-curly expansion
33\${STRING}
34
35// backslash before opening brace breaks dollar-curly identification
36$\{STRING}
37
38// bare at-sigils pass through unchanged with no variable map
39#define AT @
40#define ATAT @@
41#define ATATAT @@@
42#define ATATATAT @@@@
test/standalone/config_header/cmake/expected_config.h deleted-148
...@@ -1,148 +0,0 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2// cmakedefine
3// undefined
4/* #undef noval */
5
6// 1
7#define trueval 1
8
9// undefined
10/* #undef falseval */
11
12// undefined
13/* #undef zeroval */
14
15// 1
16#define oneval 1
17
18// 1
19#define tenval 1
20
21// 1
22#define stringval 1
23
24// whitespace test
25 #define stringval 1
26 #define stringval 1
27
28
29// cmakedefine01
30// 0
31#define boolnoval 0
32
33// 1
34#define booltrueval 1
35
36// 0
37#define boolfalseval 0
38
39// 0
40#define boolzeroval 0
41
42// 1
43#define booloneval 1
44
45// 1
46#define booltenval 1
47
48// 1
49#define boolstringval 1
50
51
52// @ substition
53
54// no substition
55//
56
57// no substition
58//
59
60// no substition
61// .
62
63// 1
64// 1
65
66// 0
67// 0
68
69// 10
70// 10
71
72// 0.1
73// 0.1
74
75// 0
76// 0
77
78// 1
79// 1
80
81// 10
82// 10
83
84// 01
85// 01
86
87// 0.10
88// 0.10
89
90// test
91// test
92
93// testtest
94// testtest
95
96// test.test
97// test.test
98
99// test10
100// test10
101
102// no substition
103//
104
105// no substition
106//
107
108// no substition
109// .
110
111// 1
112// 1
113
114// 0
115// 0
116
117// 10
118// 10
119
120// 0.1
121// 0.1
122
123// 0
124// 0
125
126// 1
127// 1
128
129// 10
130// 10
131
132// 01
133// 01
134
135// 0.10
136// 0.10
137
138// test
139// test
140
141// testtest
142// testtest
143
144// test.test
145// test.test
146
147// test10
148// test10
test/standalone/config_header/cmake/expected_pwd.sh deleted-2
...@@ -1,2 +0,0 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2echo ${PWD}
test/standalone/config_header/cmake/expected_sigil.h deleted-5
...@@ -1,5 +0,0 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2#define AT @
3#define ATAT @@
4#define ATATAT @@@
5#define ATATATAT @@@@
test/standalone/config_header/cmake/expected_stack.h deleted-4
...@@ -1,4 +0,0 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2#define NEST_UNDERSCORE_PROXY NEST_UNDERSCORE_PROXY
3
4#define NEST_UNDERSCORE_PROXY NEST_UNDERSCORE_PROXY
test/standalone/config_header/cmake/expected_wrapper.h deleted-31
...@@ -1,31 +0,0 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2// becomes TEXT
3#define TEXT
4#define TEXT
5
6// becomes `at`TEXT`at`
7#define @TEXT@
8#define @TEXT@
9
10// becomes TRAP
11#define TRAP
12
13// becomes `dollar sign`{STRING}
14#define ${STRING}
15#define ${STRING}
16
17// becomes `dollar sign`{STRING}
18#define ${STRING}
19#define ${STRING}
20
21// becomes `dollar sign`{TEXT}
22#define ${TEXT}
23#define ${TEXT}
24
25// becomes `at`STRING`at`
26#define @STRING@
27#define @STRING@
28
29#define \@STRING_VAR\@
30#define \${STRING}
31#define $\{STRING_VAR}
test/standalone/config_header/cmake/pwd.sh created+2
...@@ -0,0 +1,2 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2echo ${PWD}
test/standalone/config_header/cmake/sigil.h.in deleted-4
...@@ -1,4 +0,0 @@
1#define AT @
2#define ATAT @@
3#define ATATAT @@@
4#define ATATATAT @@@@
test/standalone/config_header/cmake/stack.h.in deleted-3
...@@ -1,3 +0,0 @@
1#define NEST_UNDERSCORE_PROXY ${NEST${UNDERSCORE}PROXY}
2
3#define NEST_UNDERSCORE_PROXY ${NEST${${NEST_UNDERSCORE${UNDERSCORE}PROXY}}PROXY}
test/standalone/config_header/cmake/wrapper.h.in deleted-30
...@@ -1,30 +0,0 @@
1// becomes TEXT
2#define @STRING@
3#define ${STRING}
4
5// becomes `at`TEXT`at`
6#define @${STRING}@
7#define @@STRING@@
8
9// becomes TRAP
10#define ${@STRING@}
11
12// becomes `dollar sign`{STRING}
13#define $@STRING_CURLY@
14#define $${STRING_CURLY}
15
16// becomes `dollar sign`{STRING}
17#define @STRING_VAR@
18#define ${STRING_VAR}
19
20// becomes `dollar sign`{TEXT}
21#define ${DOLLAR}{${STRING}}
22#define @DOLLAR@{${STRING}}
23
24// becomes `at`STRING`at`
25#define ${STRING_AT}
26#define @STRING_AT@
27
28#define \@STRING_VAR\@
29#define \${STRING_VAR}
30#define $\{STRING_VAR}