File tree 1 file changed +13
-2
lines changed
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
39
39
parseTest :: forall s a eff . (Show a , Eq a ) => s -> a -> Parser s a -> Eff (console :: CONSOLE , assert :: ASSERT | eff ) Unit
40
40
parseTest input expected p = case runParser input p of
41
41
Right actual -> assert (expected == actual)
42
- Left err -> print (" error: " ++ show err)
42
+ Left err -> assert' (" error: " ++ show err) false
43
43
44
44
parseErrorTestPosition :: forall s a eff . (Show a ) => Parser s a -> s -> Position -> Eff (console :: CONSOLE , assert :: ASSERT | eff ) Unit
45
45
parseErrorTestPosition p input expected = case runParser input p of
46
- Right _ -> print " error: ParseError expected!"
46
+ Right _ -> assert' " error: ParseError expected!" false
47
47
Left (ParseError { position: pos }) -> assert (expected == pos)
48
48
49
49
opTest :: Parser String String
@@ -90,6 +90,17 @@ isA A = true
90
90
isA _ = false
91
91
92
92
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
+
93
104
parseTest " (((a)))" 3 nested
94
105
parseTest " aaa" (Cons " a" (Cons " a" (Cons " a" Nil ))) $ many (string " a" )
95
106
parseTest " (ab)" (Just " b" ) $ parens do
You can’t perform that action at this time.
0 commit comments