| author | |
| committer | |
| log | 1eb3c64ea4ae4badbb71c92245de194b7fe7e1c4 |
| tree | 7e6cc2d858777f64966b9451b4d8f4b2e564a6e1 |
| parent | a6fded0810cdc9998101cc56804b1dc7274f9671 |
5 files changed, 127 insertions(+), 99 deletions(-)
test/standalone/config_header/autoconf_at/autoconf_at.h created+63| ... | ... | @@ -0,0 +1,63 @@ |
| 1 | /* This file was generated by ConfigHeader using the Zig Build System. */ | |
| 2 | /* Some Comment */ | |
| 3 | int foo(); | |
| 4 | // empty strings are preserved | |
| 5 | ||
| 6 | // line with misc content is preserved | |
| 7 | #define KEPT_VALUE no substitution | |
| 8 | ||
| 9 | // empty @ sigils are preserved | |
| 10 | #define AT_SIGIL_1 @ | |
| 11 | #define AT_SIGIL_2 @@ | |
| 12 | #define AT_SIGIL_3 @@@ | |
| 13 | #define AT_SIGIL_4 @@@@ | |
| 14 | ||
| 15 | // simple substitution | |
| 16 | #define SIMPLE_UNDEFINED | |
| 17 | #define SIMPLE_DEFINED | |
| 18 | #define SIMPLE_BOOL_TRUE 1 | |
| 19 | #define SIMPLE_BOOL_FALSE 0 | |
| 20 | #define SIMPLE_INTEGER 42 | |
| 21 | #define SIMPLE_STRING text | |
| 22 | ||
| 23 | // double packed substitution | |
| 24 | #define DOUBLE_PACKED texttext | |
| 25 | ||
| 26 | // triple packed substitution | |
| 27 | #define TRIPLE_PACKED text42text | |
| 28 | ||
| 29 | // double separated substitution | |
| 30 | #define DOUBLE_SEPARATED 42.42 | |
| 31 | ||
| 32 | // triple separated substitution | |
| 33 | #define TRIPLE_SEPARATED 42.1.42 | |
| 34 | ||
| 35 | // misc prefix is preserved | |
| 36 | #define MISC_PREFIX false is 0 | |
| 37 | ||
| 38 | // misc suffix is preserved | |
| 39 | #define MISC_SUFFIX 1 is true | |
| 40 | ||
| 41 | // surrounding content is preserved | |
| 42 | #define SURROUNDING what is 6*7? 42! | |
| 43 | ||
| 44 | // incomplete key is preserved | |
| 45 | #define INCOMPLETE_KEY @undefined | |
| 46 | ||
| 47 | // @-vars resolved only when they wrap valid characters, otherwise considered literals | |
| 48 | #define DOUBLE_WRAPPED @text@ | |
| 49 | ||
| 50 | // expanded variables are considered strings after expansion | |
| 51 | #define EXPANDED_STRING @string@ | |
| 52 | ||
| 53 | // variable name with underscores | |
| 54 | #define UNDERSCORED_VAR value | |
| 55 | ||
| 56 | // backslash before at-sigil does not prevent resolution | |
| 57 | #define BACKSLASH_AT \text | |
| 58 | ||
| 59 | // value that is an at-sign itself | |
| 60 | #define AT_SIGN_VALUE @ | |
| 61 | ||
| 62 | // incomplete key mid-line is preserved, trailing content kept | |
| 63 | #define INCOMPLETE_MID @incomplete trailing content |
test/standalone/config_header/autoconf_at/autoconf_at.h.in created+62| ... | ... | @@ -0,0 +1,62 @@ |
| 1 | /* Some Comment */ | |
| 2 | int foo(); | |
| 3 | // empty strings are preserved | |
| 4 | ||
| 5 | // line with misc content is preserved | |
| 6 | #define KEPT_VALUE no substitution | |
| 7 | ||
| 8 | // empty @ sigils are preserved | |
| 9 | #define AT_SIGIL_1 @ | |
| 10 | #define AT_SIGIL_2 @@ | |
| 11 | #define AT_SIGIL_3 @@@ | |
| 12 | #define AT_SIGIL_4 @@@@ | |
| 13 | ||
| 14 | // simple substitution | |
| 15 | #define SIMPLE_UNDEFINED @undefined@ | |
| 16 | #define SIMPLE_DEFINED @defined@ | |
| 17 | #define SIMPLE_BOOL_TRUE @boolean_true@ | |
| 18 | #define SIMPLE_BOOL_FALSE @boolean_false@ | |
| 19 | #define SIMPLE_INTEGER @integer@ | |
| 20 | #define SIMPLE_STRING @string@ | |
| 21 | ||
| 22 | // double packed substitution | |
| 23 | #define DOUBLE_PACKED @string@@string@ | |
| 24 | ||
| 25 | // triple packed substitution | |
| 26 | #define TRIPLE_PACKED @string@@integer@@string@ | |
| 27 | ||
| 28 | // double separated substitution | |
| 29 | #define DOUBLE_SEPARATED @integer@.@integer@ | |
| 30 | ||
| 31 | // triple separated substitution | |
| 32 | #define TRIPLE_SEPARATED @integer@.@boolean_true@.@integer@ | |
| 33 | ||
| 34 | // misc prefix is preserved | |
| 35 | #define MISC_PREFIX false is @boolean_false@ | |
| 36 | ||
| 37 | // misc suffix is preserved | |
| 38 | #define MISC_SUFFIX @boolean_true@ is true | |
| 39 | ||
| 40 | // surrounding content is preserved | |
| 41 | #define SURROUNDING what is 6*7? @integer@! | |
| 42 | ||
| 43 | // incomplete key is preserved | |
| 44 | #define INCOMPLETE_KEY @undefined | |
| 45 | ||
| 46 | // @-vars resolved only when they wrap valid characters, otherwise considered literals | |
| 47 | #define DOUBLE_WRAPPED @@string@@ | |
| 48 | ||
| 49 | // expanded variables are considered strings after expansion | |
| 50 | #define EXPANDED_STRING @string_at@ | |
| 51 | ||
| 52 | // variable name with underscores | |
| 53 | #define UNDERSCORED_VAR @underscored_var@ | |
| 54 | ||
| 55 | // backslash before at-sigil does not prevent resolution | |
| 56 | #define BACKSLASH_AT \@string@ | |
| 57 | ||
| 58 | // value that is an at-sign itself | |
| 59 | #define AT_SIGN_VALUE @at_sign@ | |
| 60 | ||
| 61 | // incomplete key mid-line is preserved, trailing content kept | |
| 62 | #define INCOMPLETE_MID @incomplete trailing content |
test/standalone/config_header/autoconf_at/autoconf_at.txt deleted-49| ... | ... | @@ -1,49 +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 | |
| 5 | no substitution | |
| 6 | // empty @ sigils are preserved | |
| 7 | @ | |
| 8 | @@ | |
| 9 | @@@ | |
| 10 | @@@@ | |
| 11 | // simple substitution | |
| 12 | ||
| 13 | ||
| 14 | 1 | |
| 15 | 0 | |
| 16 | 42 | |
| 17 | text | |
| 18 | // double packed substitution | |
| 19 | texttext | |
| 20 | // triple packed substitution | |
| 21 | text42text | |
| 22 | // double separated substitution | |
| 23 | 42.42 | |
| 24 | // triple separated substitution | |
| 25 | 42.1.42 | |
| 26 | // misc prefix is preserved | |
| 27 | false is 0 | |
| 28 | // misc suffix is preserved | |
| 29 | 1 is true | |
| 30 | // surrounding content is preserved | |
| 31 | what is 6*7? 42! | |
| 32 | // incomplete key is preserved | |
| 33 | @undefined | |
| 34 | // @-vars resolved only when they wrap valid characters, otherwise considered literals | |
| 35 | @text@ | |
| 36 | // expanded variables are considered strings after expansion | |
| 37 | @string@ | |
| 38 | ||
| 39 | // variable name with underscores | |
| 40 | value | |
| 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 deleted-48| ... | ... | @@ -1,48 +0,0 @@ |
| 1 | // empty strings are preserved | |
| 2 | ||
| 3 | // line with misc content is preserved | |
| 4 | no substitution | |
| 5 | // empty @ sigils are preserved | |
| 6 | @ | |
| 7 | @@ | |
| 8 | @@@ | |
| 9 | @@@@ | |
| 10 | // simple substitution | |
| 11 | @undefined@ | |
| 12 | @defined@ | |
| 13 | @boolean_true@ | |
| 14 | @boolean_false@ | |
| 15 | @integer@ | |
| 16 | @string@ | |
| 17 | // double packed substitution | |
| 18 | @string@@string@ | |
| 19 | // triple packed substitution | |
| 20 | @string@@integer@@string@ | |
| 21 | // double separated substitution | |
| 22 | @integer@.@integer@ | |
| 23 | // triple separated substitution | |
| 24 | @integer@.@boolean_true@.@integer@ | |
| 25 | // misc prefix is preserved | |
| 26 | false is @boolean_false@ | |
| 27 | // misc suffix is preserved | |
| 28 | @boolean_true@ is true | |
| 29 | // surrounding content is preserved | |
| 30 | what is 6*7? @integer@! | |
| 31 | // incomplete key is preserved | |
| 32 | @undefined | |
| 33 | // @-vars resolved only when they wrap valid characters, otherwise considered literals | |
| 34 | @@string@@ | |
| 35 | // expanded variables are considered strings after expansion | |
| 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/build.zig+2-2| ... | ... | @@ -30,7 +30,7 @@ pub fn build(b: *std.Build) void { |
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | 32 | const config_header_autoconf_at = b.addConfigHeader( |
| 33 | .{ .style = .{ .autoconf_at = b.path("autoconf_at/autoconf_at.txt.in") } }, | |
| 33 | .{ .style = .{ .autoconf_at = b.path("autoconf_at/autoconf_at.h.in") } }, | |
| 34 | 34 | .{ |
| 35 | 35 | .undefined = null, |
| 36 | 36 | .defined = {}, |
| ... | ... | @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void { |
| 45 | 45 | }, |
| 46 | 46 | ); |
| 47 | 47 | const check_config_header_autoconf_at = b.addCheckFile(config_header_autoconf_at.getOutputFile(), .{ |
| 48 | .expected_exact = @embedFile("autoconf_at/autoconf_at.txt"), | |
| 48 | .expected_exact = @embedFile("autoconf_at/autoconf_at.h"), | |
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | 51 | test_step.dependOn(&check_config_header.step); |