diff options
Diffstat (limited to 'stdlib/test/test/lux/control/parser.lux')
-rw-r--r-- | stdlib/test/test/lux/control/parser.lux | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/stdlib/test/test/lux/control/parser.lux b/stdlib/test/test/lux/control/parser.lux index 19ed2000d..378cbccd4 100644 --- a/stdlib/test/test/lux/control/parser.lux +++ b/stdlib/test/test/lux/control/parser.lux @@ -67,27 +67,27 @@ (context: "Combinators [Part 1]" ($_ seq (test "Can optionally succeed with some parser." - (and (match (#.Some |123) - (&.run (list (code.nat |123)) + (and (match (#.Some 123) + (&.run (list (code.nat 123)) (&.maybe s.nat))) (match #.None (&.run (list (code.int -123)) (&.maybe s.nat))))) (test "Can apply a parser 0 or more times." - (and (match (list |123 |456 |789) - (&.run (list (code.nat |123) (code.nat |456) (code.nat |789)) + (and (match (list 123 456 789) + (&.run (list (code.nat 123) (code.nat 456) (code.nat 789)) (&.some s.nat))) (match (list) (&.run (list (code.int -123)) (&.some s.nat))))) (test "Can apply a parser 1 or more times." - (and (match (list |123 |456 |789) - (&.run (list (code.nat |123) (code.nat |456) (code.nat |789)) + (and (match (list 123 456 789) + (&.run (list (code.nat 123) (code.nat 456) (code.nat 789)) (&.many s.nat))) - (match (list |123) - (&.run (list (code.nat |123)) + (match (list 123) + (&.run (list (code.nat 123)) (&.many s.nat))) (fails? (&.run (list (code.int -123)) (&.many s.nat))))) @@ -124,40 +124,40 @@ (test "Can apply a parser N times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.exactly |3 s.int))) + (&.exactly 3 s.int))) (match (list +123 +456) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.exactly |2 s.int))) + (&.exactly 2 s.int))) (fails? (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.exactly |4 s.int))))) + (&.exactly 4 s.int))))) (test "Can apply a parser at-least N times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-least |3 s.int))) + (&.at-least 3 s.int))) (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-least |2 s.int))) + (&.at-least 2 s.int))) (fails? (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-least |4 s.int))))) + (&.at-least 4 s.int))))) (test "Can apply a parser at-most N times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-most |3 s.int))) + (&.at-most 3 s.int))) (match (list +123 +456) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-most |2 s.int))) + (&.at-most 2 s.int))) (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-most |4 s.int))))) + (&.at-most 4 s.int))))) (test "Can apply a parser between N and M times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.between |3 |10 s.int))) + (&.between 3 10 s.int))) (fails? (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.between |4 |10 s.int))))) + (&.between 4 10 s.int))))) (test "Can parse while taking separators into account." (and (match (list +123 +456 +789) |