mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
add a standalone test for autoconf style addConfigHeader
This commit is contained in:
parent
0cf6ae290b
commit
c390f55e72
@ -186,6 +186,9 @@
|
|||||||
.omit_cfi = .{
|
.omit_cfi = .{
|
||||||
.path = "omit_cfi",
|
.path = "omit_cfi",
|
||||||
},
|
},
|
||||||
|
.config_header = .{
|
||||||
|
.path = "config_header",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
.paths = .{
|
.paths = .{
|
||||||
"build.zig",
|
"build.zig",
|
||||||
|
|||||||
22
test/standalone/config_header/build.zig
Normal file
22
test/standalone/config_header/build.zig
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
pub fn build(b: *std.Build) void {
|
||||||
|
const config_header = b.addConfigHeader(
|
||||||
|
.{ .style = .{ .autoconf = b.path("config.h.in") } },
|
||||||
|
.{
|
||||||
|
.SOME_NO = null,
|
||||||
|
.SOME_TRUE = true,
|
||||||
|
.SOME_FALSE = false,
|
||||||
|
.SOME_ZERO = 0,
|
||||||
|
.SOME_ONE = 1,
|
||||||
|
.SOME_TEN = 10,
|
||||||
|
.SOME_ENUM_LITERAL = .@"test",
|
||||||
|
.SOME_STRING = "test",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const check_config_header = b.addCheckFile(config_header.getOutput(), .{ .expected_exact = @embedFile("config.h") });
|
||||||
|
|
||||||
|
const test_step = b.step("test", "Test it");
|
||||||
|
test_step.dependOn(&check_config_header.step);
|
||||||
|
}
|
||||||
14
test/standalone/config_header/config.h
Normal file
14
test/standalone/config_header/config.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/* This file was generated by ConfigHeader using the Zig Build System. */
|
||||||
|
/* Some Comment */
|
||||||
|
|
||||||
|
int foo();
|
||||||
|
|
||||||
|
/* #undef SOME_NO */
|
||||||
|
#define SOME_TRUE 1
|
||||||
|
#define SOME_FALSE 0
|
||||||
|
#define SOME_ZERO 0
|
||||||
|
#define SOME_ONE 1
|
||||||
|
#define SOME_TEN 10
|
||||||
|
#define SOME_ENUM_LITERAL test
|
||||||
|
#define SOME_STRING "test"
|
||||||
|
|
||||||
12
test/standalone/config_header/config.h.in
Normal file
12
test/standalone/config_header/config.h.in
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/* Some Comment */
|
||||||
|
|
||||||
|
int foo();
|
||||||
|
|
||||||
|
#undef SOME_NO
|
||||||
|
#undef SOME_TRUE
|
||||||
|
#undef SOME_FALSE
|
||||||
|
#undef SOME_ZERO
|
||||||
|
#undef SOME_ONE
|
||||||
|
#undef SOME_TEN
|
||||||
|
#undef SOME_ENUM_LITERAL
|
||||||
|
#undef SOME_STRING
|
||||||
Loading…
x
Reference in New Issue
Block a user