aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-08-16 23:37:40 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-08-16 23:37:40 +0100
commit007b1e966d4234f2fbdc8f21d53b27dec0060b5e (patch)
tree99e02aa703470bff74f4711d1c3bd91379b897e5 /test
parent7ac5c089d447c11bb9c9152bb30e1cff5b96267e (diff)
downloadmicro-lang-hs-007b1e966d4234f2fbdc8f21d53b27dec0060b5e.tar.gz
micro-lang-hs-007b1e966d4234f2fbdc8f21d53b27dec0060b5e.zip
Unexpected return error
Diffstat (limited to 'test')
-rw-r--r--test/Language.hs27
1 files changed, 26 insertions, 1 deletions
diff --git a/test/Language.hs b/test/Language.hs
index 7892c16..9da3124 100644
--- a/test/Language.hs
+++ b/test/Language.hs
@@ -183,4 +183,29 @@ testCase12 =
Nothing -> assertFailure "expected error, didn't happen"
Just (E.TypeError _ _) -> return $ ()
-language = [testCase1, testCase2, testCase3, testCase4, testCase5, testCase6, testCase7, testCase8, testCase9, testCase10, testCase11, testCase12]
+testCase13 =
+ TestLabel "return without function" $
+ TestCase $ do
+ e <-
+ expectError
+ "module main\n\
+ \return;"
+ case e of
+ Nothing -> assertFailure "expected error, didn't happen"
+ Just (E.UnexpectedReturn _ _) -> return $ ()
+
+language =
+ [ testCase1,
+ testCase2,
+ testCase3,
+ testCase4,
+ testCase5,
+ testCase6,
+ testCase7,
+ testCase8,
+ testCase9,
+ testCase10,
+ testCase11,
+ testCase12,
+ testCase13
+ ]