zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 1eb3c64ea4ae4badbb71c92245de194b7fe7e1c4 (tree)
parent a6fded0810cdc9998101cc56804b1dc7274f9671
Author: fardragon <michaldrozd@protonmail.ch>
Date:   Fri,  5 Jun 2026 17:24:29 +0200

cleanup autoconf_at

Diffstat:
Atest/standalone/config_header/autoconf_at/autoconf_at.h | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atest/standalone/config_header/autoconf_at/autoconf_at.h.in | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dtest/standalone/config_header/autoconf_at/autoconf_at.txt | 49-------------------------------------------------
Dtest/standalone/config_header/autoconf_at/autoconf_at.txt.in | 48------------------------------------------------
Mtest/standalone/config_header/build.zig | 4++--
5 files changed, 127 insertions(+), 99 deletions(-)

diff --git a/test/standalone/config_header/autoconf_at/autoconf_at.h b/test/standalone/config_header/autoconf_at/autoconf_at.h @@ -0,0 +1,63 @@ +/* This file was generated by ConfigHeader using the Zig Build System. */ +/* Some Comment */ +int foo(); +// empty strings are preserved + +// line with misc content is preserved +#define KEPT_VALUE no substitution + +// empty @ sigils are preserved +#define AT_SIGIL_1 @ +#define AT_SIGIL_2 @@ +#define AT_SIGIL_3 @@@ +#define AT_SIGIL_4 @@@@ + +// simple substitution +#define SIMPLE_UNDEFINED +#define SIMPLE_DEFINED +#define SIMPLE_BOOL_TRUE 1 +#define SIMPLE_BOOL_FALSE 0 +#define SIMPLE_INTEGER 42 +#define SIMPLE_STRING text + +// double packed substitution +#define DOUBLE_PACKED texttext + +// triple packed substitution +#define TRIPLE_PACKED text42text + +// double separated substitution +#define DOUBLE_SEPARATED 42.42 + +// triple separated substitution +#define TRIPLE_SEPARATED 42.1.42 + +// misc prefix is preserved +#define MISC_PREFIX false is 0 + +// misc suffix is preserved +#define MISC_SUFFIX 1 is true + +// surrounding content is preserved +#define SURROUNDING what is 6*7? 42! + +// incomplete key is preserved +#define INCOMPLETE_KEY @undefined + +// @-vars resolved only when they wrap valid characters, otherwise considered literals +#define DOUBLE_WRAPPED @text@ + +// expanded variables are considered strings after expansion +#define EXPANDED_STRING @string@ + +// variable name with underscores +#define UNDERSCORED_VAR value + +// backslash before at-sigil does not prevent resolution +#define BACKSLASH_AT \text + +// value that is an at-sign itself +#define AT_SIGN_VALUE @ + +// incomplete key mid-line is preserved, trailing content kept +#define INCOMPLETE_MID @incomplete trailing content diff --git a/test/standalone/config_header/autoconf_at/autoconf_at.h.in b/test/standalone/config_header/autoconf_at/autoconf_at.h.in @@ -0,0 +1,62 @@ +/* Some Comment */ +int foo(); +// empty strings are preserved + +// line with misc content is preserved +#define KEPT_VALUE no substitution + +// empty @ sigils are preserved +#define AT_SIGIL_1 @ +#define AT_SIGIL_2 @@ +#define AT_SIGIL_3 @@@ +#define AT_SIGIL_4 @@@@ + +// simple substitution +#define SIMPLE_UNDEFINED @undefined@ +#define SIMPLE_DEFINED @defined@ +#define SIMPLE_BOOL_TRUE @boolean_true@ +#define SIMPLE_BOOL_FALSE @boolean_false@ +#define SIMPLE_INTEGER @integer@ +#define SIMPLE_STRING @string@ + +// double packed substitution +#define DOUBLE_PACKED @string@@string@ + +// triple packed substitution +#define TRIPLE_PACKED @string@@integer@@string@ + +// double separated substitution +#define DOUBLE_SEPARATED @integer@.@integer@ + +// triple separated substitution +#define TRIPLE_SEPARATED @integer@.@boolean_true@.@integer@ + +// misc prefix is preserved +#define MISC_PREFIX false is @boolean_false@ + +// misc suffix is preserved +#define MISC_SUFFIX @boolean_true@ is true + +// surrounding content is preserved +#define SURROUNDING what is 6*7? @integer@! + +// incomplete key is preserved +#define INCOMPLETE_KEY @undefined + +// @-vars resolved only when they wrap valid characters, otherwise considered literals +#define DOUBLE_WRAPPED @@string@@ + +// expanded variables are considered strings after expansion +#define EXPANDED_STRING @string_at@ + +// variable name with underscores +#define UNDERSCORED_VAR @underscored_var@ + +// backslash before at-sigil does not prevent resolution +#define BACKSLASH_AT \@string@ + +// value that is an at-sign itself +#define AT_SIGN_VALUE @at_sign@ + +// incomplete key mid-line is preserved, trailing content kept +#define INCOMPLETE_MID @incomplete trailing content diff --git a/test/standalone/config_header/autoconf_at/autoconf_at.txt b/test/standalone/config_header/autoconf_at/autoconf_at.txt @@ -1,49 +0,0 @@ -/* This file was generated by ConfigHeader using the Zig Build System. */ -// empty strings are preserved - -// line with misc content is preserved -no substitution -// empty @ sigils are preserved -@ -@@ -@@@ -@@@@ -// simple substitution - - -1 -0 -42 -text -// double packed substitution -texttext -// triple packed substitution -text42text -// double separated substitution -42.42 -// triple separated substitution -42.1.42 -// misc prefix is preserved -false is 0 -// misc suffix is preserved -1 is true -// surrounding content is preserved -what is 6*7? 42! -// incomplete key is preserved -@undefined -// @-vars resolved only when they wrap valid characters, otherwise considered literals -@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 @@ -1,48 +0,0 @@ -// empty strings are preserved - -// line with misc content is preserved -no substitution -// empty @ sigils are preserved -@ -@@ -@@@ -@@@@ -// simple substitution -@undefined@ -@defined@ -@boolean_true@ -@boolean_false@ -@integer@ -@string@ -// double packed substitution -@string@@string@ -// triple packed substitution -@string@@integer@@string@ -// double separated substitution -@integer@.@integer@ -// triple separated substitution -@integer@.@boolean_true@.@integer@ -// misc prefix is preserved -false is @boolean_false@ -// misc suffix is preserved -@boolean_true@ is true -// surrounding content is preserved -what is 6*7? @integer@! -// incomplete key is preserved -@undefined -// @-vars resolved only when they wrap valid characters, otherwise considered literals -@@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/build.zig b/test/standalone/config_header/build.zig @@ -30,7 +30,7 @@ pub fn build(b: *std.Build) void { }); const config_header_autoconf_at = b.addConfigHeader( - .{ .style = .{ .autoconf_at = b.path("autoconf_at/autoconf_at.txt.in") } }, + .{ .style = .{ .autoconf_at = b.path("autoconf_at/autoconf_at.h.in") } }, .{ .undefined = null, .defined = {}, @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void { }, ); const check_config_header_autoconf_at = b.addCheckFile(config_header_autoconf_at.getOutputFile(), .{ - .expected_exact = @embedFile("autoconf_at/autoconf_at.txt"), + .expected_exact = @embedFile("autoconf_at/autoconf_at.h"), }); test_step.dependOn(&check_config_header.step);