mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
test: add incremental compilation test for moving @src() call
This commit is contained in:
parent
43fdd061f7
commit
ceb76b2ba7
1 changed files with 29 additions and 0 deletions
29
test/incremental/move_src
Normal file
29
test/incremental/move_src
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#target=x86_64-linux
|
||||
#update=initial version
|
||||
#file=main.zig
|
||||
const std = @import("std");
|
||||
pub fn main() !void {
|
||||
try std.io.getStdOut().writer().print("{d} {d}\n", .{ foo(), bar() });
|
||||
}
|
||||
fn foo() u32 {
|
||||
return @src().line;
|
||||
}
|
||||
fn bar() u32 {
|
||||
return 123;
|
||||
}
|
||||
#expect_stdout="6 123\n"
|
||||
|
||||
#update=add newline
|
||||
#file=main.zig
|
||||
const std = @import("std");
|
||||
pub fn main() !void {
|
||||
try std.io.getStdOut().writer().print("{d} {d}\n", .{ foo(), bar() });
|
||||
}
|
||||
|
||||
fn foo() u32 {
|
||||
return @src().line;
|
||||
}
|
||||
fn bar() u32 {
|
||||
return 123;
|
||||
}
|
||||
#expect_stdout="7 123\n"
|
||||
Loading…
Add table
Reference in a new issue