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 @@
11 * 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
28 * modify stage2 tests so that only 1 uses _start and the rest use
39 pub fn main
410 * 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 {
1313 };
1414 {
1515 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
1820 // Incorrect return type
1921 case.addError(
2022 \\pub export fn _start() noreturn {
2123 \\}
22 , &[_][]const u8{":2:1: error: expected noreturn, found void"});
24 , &[_][]const u8{
25 ":2:1: error: expected noreturn, found void",
26 });
2327
2428 // Regular old hello world
2529 case.addCompareOutput(
test/stage2/test.zig+6-4
......@@ -24,7 +24,9 @@ pub fn addCases(ctx: *TestContext) !void {
2424 {
2525 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
2931 // Incorrect return type
3032 case.addError(
......@@ -321,7 +323,7 @@ pub fn addCases(ctx: *TestContext) !void {
321323 {
322324 var case = ctx.exe("multiplying numbers at runtime and comptime", linux_x64);
323325 case.addCompareOutput(
324 \\export fn _start() noreturn {
326 \\pub export fn _start() noreturn {
325327 \\ mul(3, 4);
326328 \\
327329 \\ exit();
......@@ -345,7 +347,7 @@ pub fn addCases(ctx: *TestContext) !void {
345347 );
346348 // comptime function call
347349 case.addCompareOutput(
348 \\export fn _start() noreturn {
350 \\pub export fn _start() noreturn {
349351 \\ exit();
350352 \\}
351353 \\
......@@ -369,7 +371,7 @@ pub fn addCases(ctx: *TestContext) !void {
369371 );
370372 // Inline function call
371373 case.addCompareOutput(
372 \\export fn _start() noreturn {
374 \\pub export fn _start() noreturn {
373375 \\ var x: usize = 5;
374376 \\ const y = mul(2, 3, x);
375377 \\ exit(y - 30);