Add parse error tests from Blodwen

This commit is contained in:
Edwin Brady 2019-06-29 21:37:30 +01:00
parent f9ea1ff329
commit 17c862fe00
19 changed files with 72 additions and 0 deletions

View File

@ -39,6 +39,8 @@ idrisTests
"import001", "import002",
"lazy001",
"linear001", "linear002", "linear003", "linear004", "linear005",
"perror001", "perror002", "perror003", "perror004", "perror005",
"perror006",
"record001", "record002",
"total001", "total002", "total003", "total004", "total005",
"total006"]

View File

@ -0,0 +1,8 @@
foo : Int -> Int
foo x = x
bar : (Int -> Int
bar x = let y = 42 in y + x
baz : Int -> Int
baz x = x

View File

@ -0,0 +1 @@
PError.idr:5:1--5:1:Parse error: Expected ')' (next tokens: [identifier bar, identifier x, symbol =, let, identifier y, symbol =, literal 42, in, identifier y, symbol +])

3
tests/idris2/perror001/run Executable file
View File

@ -0,0 +1,3 @@
$1 --check PError.idr
rm -rf build

View File

@ -0,0 +1,8 @@
foo : Int -> Int
foo x = x
bar : Int -> Int
bar x = let y = 42 in (y + x
baz : Int -> Int
baz x = x

View File

@ -0,0 +1 @@
PError.idr:7:1--7:1:Parse error: Expected ')' (next tokens: [identifier baz, symbol :, Int, symbol ->, Int, identifier baz, identifier x, symbol =, identifier x, end of input])

3
tests/idris2/perror002/run Executable file
View File

@ -0,0 +1,3 @@
$1 --check PError.idr
rm -rf build

View File

@ -0,0 +1,8 @@
foo : Int -> Int
foo x = x
bar : Int -> Int
bar x = let y = (42 in y + x
baz : Int -> Int
baz x = x

View File

@ -0,0 +1 @@
PError.idr:5:17--5:17:Parse error: Expected 'case', 'if', 'do', application or operator expression (next tokens: [symbol (, literal 42, in, identifier y, symbol +, identifier x, identifier baz, symbol :, Int, symbol ->])

3
tests/idris2/perror003/run Executable file
View File

@ -0,0 +1,3 @@
$1 --check PError.idr
rm -rf build

View File

@ -0,0 +1,6 @@
foo : Nat -> Nat -> Bool
foo x y with (x == y)
foo x y | True with (y == x)
foo x y | True | False | 10 = x
foo x y | True | True = x
foo x y | False = y

View File

@ -0,0 +1 @@
PError.idr:4:33--4:33:Parse error: Wrong number of 'with' arguments (next tokens: [symbol =, identifier x, identifier foo, identifier x, identifier y, symbol |, identifier True, symbol |, identifier True, symbol =])

3
tests/idris2/perror004/run Executable file
View File

@ -0,0 +1,3 @@
$1 --check PError.idr
rm -rf build

View File

@ -0,0 +1,8 @@
foo : Int -> Int
foo x = x
bar : Int -> Int
bar x = let y = 42
baz : Int -> Int
baz x = x

View File

@ -0,0 +1 @@
PError.idr:7:1--7:1:Parse error: Expected 'in' (next tokens: [identifier baz, symbol :, Int, symbol ->, Int, identifier baz, identifier x, symbol =, identifier x, end of input])

3
tests/idris2/perror005/run Executable file
View File

@ -0,0 +1,3 @@
$1 --check PError.idr
rm -rf build

View File

@ -0,0 +1,8 @@
foo : Int -> Int
foo x = x
bar : Int -> Int
bar x = if x == 95 then 0
baz : Int -> Int
baz x = x

View File

@ -0,0 +1 @@
PError.idr:7:1--7:1:Parse error: Expected 'else' (next tokens: [identifier baz, symbol :, Int, symbol ->, Int, identifier baz, identifier x, symbol =, identifier x, end of input])

3
tests/idris2/perror006/run Executable file
View File

@ -0,0 +1,3 @@
$1 --check PError.run
rm -rf build