aboutsummaryrefslogtreecommitdiff
path: root/src-self-hosted/test.zig
diff options
context:
space:
mode:
authorNoam Preil <pleasantatk@gmail.com>2020-06-26 05:00:53 -0400
committerNoam Preil <pleasantatk@gmail.com>2020-06-26 05:00:53 -0400
commit0e952a9f3a1522a6fd39d67a495d3918b8d8240d (patch)
treebc1c2d4de2fa0cae243ad53ca7e22e80a2dc93ad /src-self-hosted/test.zig
parentc8f60b2e2f15713754ac4b0911a7d13b6057264d (diff)
downloadzig-0e952a9f3a1522a6fd39d67a495d3918b8d8240d.tar.gz
zig-0e952a9f3a1522a6fd39d67a495d3918b8d8240d.zip
Stage2/Testing: Simply incremental compilation tests
Diffstat (limited to 'src-self-hosted/test.zig')
-rw-r--r--src-self-hosted/test.zig26
1 files changed, 26 insertions, 0 deletions
diff --git a/src-self-hosted/test.zig b/src-self-hosted/test.zig
index 13f08d86e2..cb1a9f6981 100644
--- a/src-self-hosted/test.zig
+++ b/src-self-hosted/test.zig
@@ -274,6 +274,32 @@ pub const TestContext = struct {
ctx.addObj(name, target, T).compiles(src);
}
+ pub fn incrementalFailure(
+ ctx: *TestContext,
+ name: []const u8,
+ target: std.zig.CrossTarget,
+ src: [:0]const u8,
+ expected_errors: []const []const u8,
+ fixed_src: [:0]const u8,
+ ) void {
+ var case = ctx.addObj(name, target, .Zig);
+ case.addError(src, expected_errors);
+ case.compiles(fixed_src);
+ }
+
+ pub fn incrementalFailureZIR(
+ ctx: *TestContext,
+ name: []const u8,
+ target: std.zig.CrossTarget,
+ src: [:0]const u8,
+ expected_errors: []const []const u8,
+ fixed_src: [:0]const u8,
+ ) void {
+ var case = ctx.addObj(name, target, .ZIR);
+ case.addError(src, expected_errors);
+ case.compiles(fixed_src);
+ }
+
pub fn compiles(
ctx: *TestContext,
name: []const u8,