Skip to content

Commit 15d1716

Browse files
committed
tests: add tests for error propagation
Except for the `TupleCons` one, the added tests represent code that was previously failing.
1 parent c059929 commit 15d1716

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

tests/errors/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This directory contains tests for error handling. More specifically, tests that
2+
make sure the compiler is able continue without crashing after encountering an
3+
error in the input program.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
discard """
2+
description: "Either the if or else branch has an error"
3+
reject: true
4+
"""
5+
(Module
6+
(ProcDecl (Ident "test") (UnitTy) (Params (ParamDecl (Ident "x") (IntTy)))
7+
(Return))
8+
(ProcDecl (Ident "main") (UnitTy) (Params)
9+
(Call (Ident "test") (Ident "missing"))))

tests/errors/terror_in_if.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
discard """
2+
description: "Either the if or else branch has an error"
3+
reject: true
4+
"""
5+
(If (Ident "true")
6+
(Ident "missing")
7+
(IntVal 10))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
discard """
2+
description: "Either the if or else branch has an error"
3+
reject: true
4+
"""
5+
(TupleCons (Ident "missing"))

0 commit comments

Comments
 (0)