test: remove old-style incremental cases, add a few new incremental cases
These cases have been disabled for a while, and we have transitioned to using a compact file format for incremental test cases. I was originally planning to port all of these cases, but the vast majority aren't testing anything interesting, so it wasn't worth the effort. I did look through each one; anything interesting being tested has been extracted into a new case in `test/incremental/`. Two of the new tests are currently failing with the self-hosted ELF linker, and thus are currently only enabled with the C backend. Resolves: #12844
This commit is contained in:
35
test/incremental/change_fn_type
Normal file
35
test/incremental/change_fn_type
Normal file
@@ -0,0 +1,35 @@
|
||||
#target=x86_64-linux-selfhosted
|
||||
#target=x86_64-linux-cbe
|
||||
#target=x86_64-windows-cbe
|
||||
#update=initial version
|
||||
#file=main.zig
|
||||
pub fn main() !void {
|
||||
try foo(123);
|
||||
}
|
||||
fn foo(x: u8) !void {
|
||||
return std.io.getStdOut().writer().print("{d}\n", .{x});
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="123\n"
|
||||
|
||||
#update=change function type
|
||||
#file=main.zig
|
||||
pub fn main() !void {
|
||||
try foo(123);
|
||||
}
|
||||
fn foo(x: i64) !void {
|
||||
return std.io.getStdOut().writer().print("{d}\n", .{x});
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="123\n"
|
||||
|
||||
#update=change function argument
|
||||
#file=main.zig
|
||||
pub fn main() !void {
|
||||
try foo(-42);
|
||||
}
|
||||
fn foo(x: i64) !void {
|
||||
return std.io.getStdOut().writer().print("{d}\n", .{x});
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="-42\n"
|
||||
50
test/incremental/change_struct_same_fields
Normal file
50
test/incremental/change_struct_same_fields
Normal file
@@ -0,0 +1,50 @@
|
||||
#target=x86_64-linux-selfhosted
|
||||
#target=x86_64-linux-cbe
|
||||
#target=x86_64-windows-cbe
|
||||
#update=initial version
|
||||
#file=main.zig
|
||||
const S = extern struct { x: u8, y: u8 };
|
||||
pub fn main() !void {
|
||||
const val: S = .{ .x = 100, .y = 200 };
|
||||
try foo(&val);
|
||||
}
|
||||
fn foo(val: *const S) !void {
|
||||
try std.io.getStdOut().writer().print(
|
||||
"{d} {d}\n",
|
||||
.{ val.x, val.y },
|
||||
);
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="100 200\n"
|
||||
|
||||
#update=change struct layout
|
||||
#file=main.zig
|
||||
const S = extern struct { x: u32, y: u32 };
|
||||
pub fn main() !void {
|
||||
const val: S = .{ .x = 100, .y = 200 };
|
||||
try foo(&val);
|
||||
}
|
||||
fn foo(val: *const S) !void {
|
||||
try std.io.getStdOut().writer().print(
|
||||
"{d} {d}\n",
|
||||
.{ val.x, val.y },
|
||||
);
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="100 200\n"
|
||||
|
||||
#update=change values
|
||||
#file=main.zig
|
||||
const S = extern struct { x: u32, y: u32 };
|
||||
pub fn main() !void {
|
||||
const val: S = .{ .x = 1234, .y = 5678 };
|
||||
try foo(&val);
|
||||
}
|
||||
fn foo(val: *const S) !void {
|
||||
try std.io.getStdOut().writer().print(
|
||||
"{d} {d}\n",
|
||||
.{ val.x, val.y },
|
||||
);
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="1234 5678\n"
|
||||
21
test/incremental/compile_error_then_log
Normal file
21
test/incremental/compile_error_then_log
Normal file
@@ -0,0 +1,21 @@
|
||||
#target=x86_64-linux-selfhosted
|
||||
#target=x86_64-linux-cbe
|
||||
#target=x86_64-windows-cbe
|
||||
#update=initial version with compile error
|
||||
#file=main.zig
|
||||
comptime {
|
||||
@compileError("this is an error");
|
||||
}
|
||||
comptime {
|
||||
@compileLog("this is a log");
|
||||
}
|
||||
#expect_error=ignored
|
||||
#update=remove the compile error
|
||||
#file=main.zig
|
||||
comptime {
|
||||
//@compileError("this is an error");
|
||||
}
|
||||
comptime {
|
||||
@compileLog("this is a log");
|
||||
}
|
||||
#expect_error=ignored
|
||||
35
test/incremental/function_becomes_inline
Normal file
35
test/incremental/function_becomes_inline
Normal file
@@ -0,0 +1,35 @@
|
||||
//#target=x86_64-linux-selfhosted
|
||||
#target=x86_64-linux-cbe
|
||||
#target=x86_64-windows-cbe
|
||||
#update=non-inline version
|
||||
#file=main.zig
|
||||
pub fn main() !void {
|
||||
try foo();
|
||||
}
|
||||
fn foo() !void {
|
||||
try std.io.getStdOut().writer().writeAll("Hello, World!\n");
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="Hello, World!\n"
|
||||
|
||||
#update=make function inline
|
||||
#file=main.zig
|
||||
pub fn main() !void {
|
||||
try foo();
|
||||
}
|
||||
inline fn foo() !void {
|
||||
try std.io.getStdOut().writer().writeAll("Hello, World!\n");
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="Hello, World!\n"
|
||||
|
||||
#update=change string
|
||||
#file=main.zig
|
||||
pub fn main() !void {
|
||||
try foo();
|
||||
}
|
||||
inline fn foo() !void {
|
||||
try std.io.getStdOut().writer().writeAll("Hello, `inline` World!\n");
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="Hello, `inline` World!\n"
|
||||
28
test/incremental/recursive_function_becomes_non_recursive
Normal file
28
test/incremental/recursive_function_becomes_non_recursive
Normal file
@@ -0,0 +1,28 @@
|
||||
//#target=x86_64-linux-selfhosted
|
||||
#target=x86_64-linux-cbe
|
||||
#target=x86_64-windows-cbe
|
||||
#update=initial version
|
||||
#file=main.zig
|
||||
pub fn main() !void {
|
||||
try foo(false);
|
||||
}
|
||||
fn foo(recurse: bool) !void {
|
||||
const stdout = std.io.getStdOut().writer();
|
||||
if (recurse) return foo(true);
|
||||
try stdout.writeAll("non-recursive path\n");
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="non-recursive path\n"
|
||||
|
||||
#update=eliminate recursion and change argument
|
||||
#file=main.zig
|
||||
pub fn main() !void {
|
||||
try foo(true);
|
||||
}
|
||||
fn foo(recurse: bool) !void {
|
||||
const stdout = std.io.getStdOut().writer();
|
||||
if (recurse) return stdout.writeAll("x==1\n");
|
||||
try stdout.writeAll("non-recursive path\n");
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="x==1\n"
|
||||
Reference in New Issue
Block a user