authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-09 09:52:33-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-09 09:52:33-05:00
log264b03d57027da4b7c6e691d9b2a4340cd10fff0
tree85f61519a0cef4633c59043acf39b7c0928a84cb
parent8369ddb09c6fb4ae86d04a8e838c7be42bc22097

use unique test source names for test-gen-h


1 files changed, 7 insertions(+), 1 deletions(-)

test/tests.zig+7-1
......@@ -158,6 +158,7 @@ pub fn addGenHTests(b: *build.Builder, test_filter: ?[]const u8) *build.Step {
158158 .step = b.step("test-gen-h", "Run the C header file generation tests"),
159159 .test_index = 0,
160160 .test_filter = test_filter,
161 .counter = 0,
161162 };
162163
163164 gen_h.addCases(cases);
......@@ -1104,6 +1105,7 @@ pub const GenHContext = struct {
11041105 step: *build.Step,
11051106 test_index: usize,
11061107 test_filter: ?[]const u8,
1108 counter: usize,
11071109
11081110 const TestCase = struct {
11091111 name: []const u8,
......@@ -1206,7 +1208,11 @@ pub const GenHContext = struct {
12061208 }
12071209
12081210 pub fn add(self: *GenHContext, name: []const u8, source: []const u8, expected_lines: ...) void {
1209 const tc = self.create("test.zig", name, source, expected_lines);
1211 // MacOS appears to not be returning nanoseconds in fstat mtime,
1212 // which causes fast test executions to think the file contents are unchanged.
1213 const modified_name = self.b.fmt("test-{}.zig", self.counter);
1214 self.counter += 1;
1215 const tc = self.create(modified_name, name, source, expected_lines);
12101216 self.addCase(tc);
12111217 }
12121218