aboutsummaryrefslogtreecommitdiff
path: root/test/Language.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-09-04 08:21:31 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-09-04 08:21:31 +0100
commita33620210a161a20b60a138a0b984a5336a45f2d (patch)
tree1a7822d9ec513a9578b8c7e87d4748f3434c8e74 /test/Language.hs
parent1942efe3c45c87ef4f1c73d6078ff6487b820b53 (diff)
downloadmicro-lang-hs-a33620210a161a20b60a138a0b984a5336a45f2d.tar.gz
micro-lang-hs-a33620210a161a20b60a138a0b984a5336a45f2d.zip
Type-checking variable declaration
Diffstat (limited to 'test/Language.hs')
-rw-r--r--test/Language.hs20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/Language.hs b/test/Language.hs
index 19ec5bf..84c72ae 100644
--- a/test/Language.hs
+++ b/test/Language.hs
@@ -309,6 +309,22 @@ testCaseE12 =
\var a: undef = 1;\n"
E.UndefinedType
+testCaseE13 =
+ TestLabel "type mismatch in variable declaration" $
+ TestCase $
+ expectError
+ "module main\n\
+ \var a: bool = 0;\n"
+ E.TypeError
+
+testCaseE14 =
+ TestLabel "type mismatch in variable declaration (lambda)" $
+ TestCase $
+ expectError
+ "module main\n\
+ \var a: bool = (a:u8): u8 { return a; };\n"
+ E.TypeError
+
language =
[ testCase2,
testCase3,
@@ -334,5 +350,7 @@ language =
testCaseE9,
testCaseE10,
testCaseE11,
- testCaseE12
+ testCaseE12,
+ testCaseE13,
+ testCaseE14
]