authorgravatar for techatrix@mailbox.orgTechatrix <techatrix@mailbox.org> 2025-02-19 09:34:25+01:00
committergravatar for techatrix@mailbox.orgTechatrix <techatrix@mailbox.org> 2025-02-19 09:34:25+01:00
logc390f55e727c8f4ace2eb7992403bf8332a22126
tree4a01d3509a06a6dce19ea8830f1b4319c0682680
parent0cf6ae290b97e7fee7e37b5c487fd3e6b35248b3
signaturebadge-check Signed by SSH key SHA256:HYC3SjXQcAt6uwv9pu/6OoVQ2rUH8rb5zKiUHSe9uxk

add a standalone test for autoconf style addConfigHeader


4 files changed, 51 insertions(+), 0 deletions(-)

test/standalone/build.zig.zon+3
......@@ -186,6 +186,9 @@
186186 .omit_cfi = .{
187187 .path = "omit_cfi",
188188 },
189 .config_header = .{
190 .path = "config_header",
191 },
189192 },
190193 .paths = .{
191194 "build.zig",
test/standalone/config_header/build.zig created+22
......@@ -0,0 +1,22 @@
1const std = @import("std");
2
3pub fn build(b: *std.Build) void {
4 const config_header = b.addConfigHeader(
5 .{ .style = .{ .autoconf = b.path("config.h.in") } },
6 .{
7 .SOME_NO = null,
8 .SOME_TRUE = true,
9 .SOME_FALSE = false,
10 .SOME_ZERO = 0,
11 .SOME_ONE = 1,
12 .SOME_TEN = 10,
13 .SOME_ENUM_LITERAL = .@"test",
14 .SOME_STRING = "test",
15 },
16 );
17
18 const check_config_header = b.addCheckFile(config_header.getOutput(), .{ .expected_exact = @embedFile("config.h") });
19
20 const test_step = b.step("test", "Test it");
21 test_step.dependOn(&check_config_header.step);
22}
test/standalone/config_header/config.h created+14
......@@ -0,0 +1,14 @@
1/* This file was generated by ConfigHeader using the Zig Build System. */
2/* Some Comment */
3
4int foo();
5
6/* #undef SOME_NO */
7#define SOME_TRUE 1
8#define SOME_FALSE 0
9#define SOME_ZERO 0
10#define SOME_ONE 1
11#define SOME_TEN 10
12#define SOME_ENUM_LITERAL test
13#define SOME_STRING "test"
14
test/standalone/config_header/config.h.in created+12
......@@ -0,0 +1,12 @@
1/* Some Comment */
2
3int foo();
4
5#undef SOME_NO
6#undef SOME_TRUE
7#undef SOME_FALSE
8#undef SOME_ZERO
9#undef SOME_ONE
10#undef SOME_TEN
11#undef SOME_ENUM_LITERAL
12#undef SOME_STRING