mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
use unique test source names for test-gen-h
This commit is contained in:
parent
8369ddb09c
commit
264b03d570
@ -158,6 +158,7 @@ pub fn addGenHTests(b: *build.Builder, test_filter: ?[]const u8) *build.Step {
|
|||||||
.step = b.step("test-gen-h", "Run the C header file generation tests"),
|
.step = b.step("test-gen-h", "Run the C header file generation tests"),
|
||||||
.test_index = 0,
|
.test_index = 0,
|
||||||
.test_filter = test_filter,
|
.test_filter = test_filter,
|
||||||
|
.counter = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
gen_h.addCases(cases);
|
gen_h.addCases(cases);
|
||||||
@ -1104,6 +1105,7 @@ pub const GenHContext = struct {
|
|||||||
step: *build.Step,
|
step: *build.Step,
|
||||||
test_index: usize,
|
test_index: usize,
|
||||||
test_filter: ?[]const u8,
|
test_filter: ?[]const u8,
|
||||||
|
counter: usize,
|
||||||
|
|
||||||
const TestCase = struct {
|
const TestCase = struct {
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
@ -1206,7 +1208,11 @@ pub const GenHContext = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn add(self: *GenHContext, name: []const u8, source: []const u8, expected_lines: ...) void {
|
pub fn add(self: *GenHContext, name: []const u8, source: []const u8, expected_lines: ...) void {
|
||||||
const tc = self.create("test.zig", name, source, expected_lines);
|
// MacOS appears to not be returning nanoseconds in fstat mtime,
|
||||||
|
// which causes fast test executions to think the file contents are unchanged.
|
||||||
|
const modified_name = self.b.fmt("test-{}.zig", self.counter);
|
||||||
|
self.counter += 1;
|
||||||
|
const tc = self.create(modified_name, name, source, expected_lines);
|
||||||
self.addCase(tc);
|
self.addCase(tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user