File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,11 @@ nested = fix \p -> (do
3939parseTest :: forall s a eff . (Show a , Eq a ) => s -> a -> Parser s a -> Eff (console :: CONSOLE , assert :: ASSERT | eff ) Unit
4040parseTest 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
4444parseErrorTestPosition :: forall s a eff . (Show a ) => Parser s a -> s -> Position -> Eff (console :: CONSOLE , assert :: ASSERT | eff ) Unit
4545parseErrorTestPosition 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
4949opTest :: Parser String String
@@ -90,6 +90,17 @@ isA A = true
9090isA _ = false
9191
9292main = 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
You can’t perform that action at this time.
0 commit comments