authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-13 20:44:34-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-13 20:44:34-07:00
log134853f1068624dfda4be0feadd653ed3ee92cc3
treea761ad1fbfb7b6841caca03f5dcfc0723d01312f
parent579694893ee082ed829b017694fece4e7f41946f

stage2: fix tests expected values


3 files changed, 18 insertions(+), 6 deletions(-)

BRANCH_TODO+6
...@@ -1,4 +1,10 @@...@@ -1,4 +1,10 @@
1 * get stage2 tests passing1 * get stage2 tests passing
2 - after the error from an empty file, "has no member main" is invalidated
3 but the comptime block incorrectly does not get re-run
4 - redundant comptime wrong source loc
5 - redeclaration of 'foo' not showing 'previously declared here'
6 - segfault in one of the tests
7 - memory leaks
2 * modify stage2 tests so that only 1 uses _start and the rest use8 * modify stage2 tests so that only 1 uses _start and the rest use
3 pub fn main9 pub fn main
4 * modify stage2 CBE tests so that only 1 uses pub export main and the10 * modify stage2 CBE tests so that only 1 uses pub export main and the
test/stage2/darwin.zig+6-2
...@@ -13,13 +13,17 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -13,13 +13,17 @@ pub fn addCases(ctx: *TestContext) !void {
13 };13 };
14 {14 {
15 var case = ctx.exe("hello world with updates", target);15 var case = ctx.exe("hello world with updates", target);
16 case.addError("", &[_][]const u8{"error: no entry point found"});16 case.addError("", &[_][]const u8{
17 ":84:9: error: struct 'test_case.test_case' has no member named 'main'",
18 });
1719
18 // Incorrect return type20 // Incorrect return type
19 case.addError(21 case.addError(
20 \\pub export fn _start() noreturn {22 \\pub export fn _start() noreturn {
21 \\}23 \\}
22 , &[_][]const u8{":2:1: error: expected noreturn, found void"});24 , &[_][]const u8{
25 ":2:1: error: expected noreturn, found void",
26 });
2327
24 // Regular old hello world28 // Regular old hello world
25 case.addCompareOutput(29 case.addCompareOutput(
test/stage2/test.zig+6-4
...@@ -24,7 +24,9 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -24,7 +24,9 @@ pub fn addCases(ctx: *TestContext) !void {
24 {24 {
25 var case = ctx.exe("hello world with updates", linux_x64);25 var case = ctx.exe("hello world with updates", linux_x64);
2626
27 case.addError("", &[_][]const u8{"error: no entry point found"});27 case.addError("", &[_][]const u8{
28 ":84:9: error: struct 'test_case.test_case' has no member named 'main'",
29 });
2830
29 // Incorrect return type31 // Incorrect return type
30 case.addError(32 case.addError(
...@@ -321,7 +323,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -321,7 +323,7 @@ pub fn addCases(ctx: *TestContext) !void {
321 {323 {
322 var case = ctx.exe("multiplying numbers at runtime and comptime", linux_x64);324 var case = ctx.exe("multiplying numbers at runtime and comptime", linux_x64);
323 case.addCompareOutput(325 case.addCompareOutput(
324 \\export fn _start() noreturn {326 \\pub export fn _start() noreturn {
325 \\ mul(3, 4);327 \\ mul(3, 4);
326 \\328 \\
327 \\ exit();329 \\ exit();
...@@ -345,7 +347,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -345,7 +347,7 @@ pub fn addCases(ctx: *TestContext) !void {
345 );347 );
346 // comptime function call348 // comptime function call
347 case.addCompareOutput(349 case.addCompareOutput(
348 \\export fn _start() noreturn {350 \\pub export fn _start() noreturn {
349 \\ exit();351 \\ exit();
350 \\}352 \\}
351 \\353 \\
...@@ -369,7 +371,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -369,7 +371,7 @@ pub fn addCases(ctx: *TestContext) !void {
369 );371 );
370 // Inline function call372 // Inline function call
371 case.addCompareOutput(373 case.addCompareOutput(
372 \\export fn _start() noreturn {374 \\pub export fn _start() noreturn {
373 \\ var x: usize = 5;375 \\ var x: usize = 5;
374 \\ const y = mul(2, 3, x);376 \\ const y = mul(2, 3, x);
375 \\ exit(y - 30);377 \\ exit(y - 30);