fix: broken conditionals
This commit is contained in:
parent
b231e66b49
commit
97a43f63eb
33 changed files with 358 additions and 313 deletions
|
|
@ -91,6 +91,40 @@ test "compiler: constant cycle detection" {
|
|||
);
|
||||
}
|
||||
|
||||
test "compiler: final else case" {
|
||||
try testEqual(
|
||||
\\{true:
|
||||
\\- else:
|
||||
\\ False
|
||||
\\- 1 == 1:
|
||||
\\ Woops!
|
||||
\\}
|
||||
,
|
||||
\\<STDIN>:2:3: error: 'else' case should always be the final case in conditional
|
||||
\\2 | - else:
|
||||
\\ | ^
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "compiler: final else case 2" {
|
||||
try testEqual(
|
||||
\\{
|
||||
\\- true:
|
||||
\\ True
|
||||
\\- else:
|
||||
\\ False
|
||||
\\- else:
|
||||
\\ False
|
||||
\\}
|
||||
,
|
||||
\\<STDIN>:4:3: error: 'else' case should always be the final case in conditional
|
||||
\\4 | - else:
|
||||
\\ | ^
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
fn testEqual(source_bytes: [:0]const u8, expected_error: []const u8) !void {
|
||||
const gpa = std.testing.allocator;
|
||||
var arena_allocator = std.heap.ArenaAllocator.init(gpa);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue