diff options
Diffstat (limited to 'stdlib/source/test/lux/control/parser/text.lux')
-rw-r--r-- | stdlib/source/test/lux/control/parser/text.lux | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index 878b82fa9..a7bbfda92 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -5,11 +5,11 @@ [abstract [monad (#+ do)]] [control + ["." maybe] ["." try (#+ Try)] ["." exception (#+ Exception)] ["." function]] [data - ["." maybe] ["." text ("#\." equivalence) ["%" format (#+ format)] ["." unicode #_ @@ -41,7 +41,7 @@ (def: (should_fail' sample parser exception) (All [a e] (-> Text (/.Parser a) (Exception e) Bit)) - (case (/.run parser sample) + (case (/.result parser sample) (#try.Failure error) (exception.match? exception error) @@ -50,7 +50,7 @@ (def: (should_fail sample parser) (All [a] (-> Text (/.Parser a) Bit)) - (case (/.run parser sample) + (case (/.result parser sample) (#try.Failure _) true @@ -60,7 +60,7 @@ (def: (should_pass expected parser) (-> Text (/.Parser Text) Bit) (|> expected - (/.run parser) + (/.result parser) (\ try.functor map (text\= expected)) (try.else false))) @@ -298,12 +298,12 @@ ($_ _.and (do {! random.monad} [sample (random.unicode 1)] - (_.cover [/.run /.end!] - (and (|> (/.run /.end! - "") + (_.cover [/.result /.end!] + (and (|> (/.result /.end! + "") (!expect (#try.Success _))) - (|> (/.run /.end! - sample) + (|> (/.result /.end! + sample) (!expect (#try.Failure _)))))) (do {! random.monad} [.let [size 10] @@ -311,16 +311,16 @@ dummy (|> (random.unicode size) (random.only (|>> (text\= expected) not)))] (_.cover [/.this /.cannot_match] - (and (|> (/.run (/.this expected) - expected) + (and (|> (/.result (/.this expected) + expected) (!expect (#try.Success []))) - (|> (/.run (/.this expected) - dummy) + (|> (/.result (/.this expected) + dummy) (!expect (^multi (#try.Failure error) (exception.match? /.cannot_match error))))))) (_.cover [/.Slice /.slice /.cannot_slice] (|> "" - (/.run (/.slice /.any!)) + (/.result (/.slice /.any!)) (!expect (^multi (#try.Failure error) (exception.match? /.cannot_slice error))))) (do {! random.monad} @@ -336,25 +336,25 @@ (_.cover [/.peek /.cannot_parse] (and (..should_pass expected (<>.before /.any /.peek)) (|> "" - (/.run (<>.before /.any /.peek)) + (/.result (<>.before /.any /.peek)) (!expect (^multi (#try.Failure error) (exception.match? /.cannot_parse error))))))) (do {! random.monad} [dummy (random.unicode 1)] (_.cover [/.unconsumed_input] (|> (format dummy dummy) - (/.run /.any) + (/.result /.any) (!expect (^multi (#try.Failure error) (exception.match? /.unconsumed_input error)))))) (do {! random.monad} [sample (random.unicode 1)] (_.cover [/.Offset /.offset] (|> sample - (/.run (do <>.monad - [pre /.offset - _ /.any - post /.offset] - (in [pre post]))) + (/.result (do <>.monad + [pre /.offset + _ /.any + post /.offset] + (in [pre post]))) (!expect (#try.Success [0 1]))))) (do {! random.monad} [left (random.unicode 1) @@ -362,13 +362,13 @@ .let [input (format left right)]] (_.cover [/.remaining] (|> input - (/.run (do <>.monad - [pre /.remaining - _ /.any - post /.remaining - _ /.any] - (in (and (text\= input pre) - (text\= right post))))) + (/.result (do <>.monad + [pre /.remaining + _ /.any + post /.remaining + _ /.any] + (in (and (text\= input pre) + (text\= right post))))) (!expect (#try.Success #1))))) (do {! random.monad} [left (random.unicode 1) @@ -377,22 +377,22 @@ (random.unicode 1))] (_.cover [/.enclosed] (|> (format left expected right) - (/.run (/.enclosed [left right] (/.this expected))) + (/.result (/.enclosed [left right] (/.this expected))) (!expect (#try.Success _))))) (do {! random.monad} [input (random.unicode 1) output (random.unicode 1)] (_.cover [/.local] (|> output - (/.run (do <>.monad - [_ (/.local input (/.this input))] - (/.this output))) + (/.result (do <>.monad + [_ (/.local input (/.this input))] + (/.this output))) (!expect (#try.Success _))))) (do {! random.monad} [expected (\ ! map (|>> (n.% 8) (\ n.octal encode)) random.nat)] (_.cover [/.then] (|> (list (code.text expected)) - (<c>.run (/.then /.octal <c>.text)) + (<c>.result (/.then /.octal <c>.text)) (!expect (^multi (#try.Success actual) (text\= expected actual)))))) (do {! random.monad} @@ -404,13 +404,13 @@ (_.cover [/.not /.not! /.expected_to_fail] (and (..should_pass (text.of_char expected) (/.not /.upper)) (|> invalid - (/.run (/.not /.upper)) + (/.result (/.not /.upper)) (!expect (^multi (#try.Failure error) (exception.match? /.expected_to_fail error)))) (..should_pass! (text.of_char expected) (/.not! upper!)) (|> invalid - (/.run (/.not! upper!)) + (/.result (/.not! upper!)) (!expect (^multi (#try.Failure error) (exception.match? /.expected_to_fail error))))))) (do {! random.monad} |