Skip to content

Commit 167d417

Browse files
committed
Variables test
1 parent d044eb5 commit 167d417

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

tests/runner.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ std::string readFile(const std::string& file) {
4848
}
4949

5050
TEST_FILE(IntegrationTests, Arithmetic, "tests/arithmetic.eig");
51+
TEST_FILE(IntegrationTests, Variables, "tests/variables.eig");

tests/variables.eig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
~ Variables Tests
2+
3+
let x = 10
4+
emitln(x)
5+
6+
{
7+
emitln(x)
8+
9+
let x = 50
10+
emitln(x)
11+
}
12+
emitln(x)
13+
14+
{ x = 100 }
15+
emitln(x)
16+
17+
{
18+
let y = 20
19+
emitln(y)
20+
}
21+
emitln(y) ~ Should error

tests/variables.eig.out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
10
2+
10
3+
50
4+
10
5+
100
6+
20
7+
RUNTIME_ERROR: Variable y is not defined at line 21

0 commit comments

Comments
 (0)