Skip to content

Commit eb8db28

Browse files
committed
Merge pull request #18 from felixSchl/master
Add failing newlines test
2 parents 204c679 + 55de216 commit eb8db28

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/Main.purs

+13-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ nested = fix \p -> (do
3939
parseTest :: forall s a eff. (Show a, Eq a) => s -> a -> Parser s a -> Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
4040
parseTest input expected p = case runParser input p of
4141
Right actual -> assert (expected == actual)
42-
Left err -> print ("error: " ++ show err)
42+
Left err -> assert' ("error: " ++ show err) false
4343

4444
parseErrorTestPosition :: forall s a eff. (Show a) => Parser s a -> s -> Position -> Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
4545
parseErrorTestPosition p input expected = case runParser input p of
46-
Right _ -> print "error: ParseError expected!"
46+
Right _ -> assert' "error: ParseError expected!" false
4747
Left (ParseError { position: pos }) -> assert (expected == pos)
4848

4949
opTest :: Parser String String
@@ -90,6 +90,17 @@ isA A = true
9090
isA _ = false
9191

9292
main = do
93+
94+
parseErrorTestPosition
95+
(many $ char 'f' *> char '?')
96+
"foo"
97+
(Position { column: 3, line: 1 })
98+
99+
parseTest
100+
"foo"
101+
Nil
102+
(many $ try $ char 'f' *> char '?')
103+
93104
parseTest "(((a)))" 3 nested
94105
parseTest "aaa" (Cons "a" (Cons "a" (Cons "a" Nil))) $ many (string "a")
95106
parseTest "(ab)" (Just "b") $ parens do

0 commit comments

Comments
 (0)