aboutsummaryrefslogtreecommitdiff
path: root/test/incremental/add_decl
blob: 9efd274b9eb5a6d34667153922ee53f5ec6f7d82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe
#target=x86_64-windows-cbe
//#target=wasm32-wasi-selfhosted
#update=initial version
#file=main.zig
const std = @import("std");
pub fn main() !void {
    try std.fs.File.stdout().writeAll(foo);
}
const foo = "good morning\n";
#expect_stdout="good morning\n"

#update=add new declaration
#file=main.zig
const std = @import("std");
pub fn main() !void {
    try std.fs.File.stdout().writeAll(foo);
}
const foo = "good morning\n";
const bar = "good evening\n";
#expect_stdout="good morning\n"

#update=reference new declaration
#file=main.zig
const std = @import("std");
pub fn main() !void {
    try std.fs.File.stdout().writeAll(bar);
}
const foo = "good morning\n";
const bar = "good evening\n";
#expect_stdout="good evening\n"

#update=reference missing declaration
#file=main.zig
const std = @import("std");
pub fn main() !void {
    try std.fs.File.stdout().writeAll(qux);
}
const foo = "good morning\n";
const bar = "good evening\n";
#expect_error=main.zig:3:39: error: use of undeclared identifier 'qux'

#update=add missing declaration
#file=main.zig
const std = @import("std");
pub fn main() !void {
    try std.fs.File.stdout().writeAll(qux);
}
const foo = "good morning\n";
const bar = "good evening\n";
const qux = "good night\n";
#expect_stdout="good night\n"

#update=remove unused declarations
#file=main.zig
const std = @import("std");
pub fn main() !void {
    try std.fs.File.stdout().writeAll(qux);
}
const qux = "good night\n";
#expect_stdout="good night\n"