aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/control/parser/text.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/control/parser/text.lux350
1 files changed, 175 insertions, 175 deletions
diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux
index eb09bad2a..94f067ef7 100644
--- a/stdlib/source/test/lux/control/parser/text.lux
+++ b/stdlib/source/test/lux/control/parser/text.lux
@@ -80,50 +80,50 @@
out_of_range (case offset
0 (# ! each (|>> (n.% 10) ++ (n.+ limit) text.of_char) random.nat)
_ (# ! each (|>> (n.% offset) text.of_char) random.nat))]
- (_.cover [/.range]
- (and (..should_pass expected (/.range offset limit))
- (..should_fail out_of_range (/.range offset limit)))))
+ (_.coverage [/.range]
+ (and (..should_pass expected (/.range offset limit))
+ (..should_fail out_of_range (/.range offset limit)))))
(do [! random.monad]
[expected (random.char unicode.upper_case)
invalid (random.only (|>> (unicode/block.within? unicode/block.upper_case) not)
(random.char unicode.character))]
- (_.cover [/.upper]
- (and (..should_pass (text.of_char expected) /.upper)
- (..should_fail (text.of_char invalid) /.upper))))
+ (_.coverage [/.upper]
+ (and (..should_pass (text.of_char expected) /.upper)
+ (..should_fail (text.of_char invalid) /.upper))))
(do [! random.monad]
[expected (random.char unicode.lower_case)
invalid (random.only (|>> (unicode/block.within? unicode/block.lower_case) not)
(random.char unicode.character))]
- (_.cover [/.lower]
- (and (..should_pass (text.of_char expected) /.lower)
- (..should_fail (text.of_char invalid) /.lower))))
+ (_.coverage [/.lower]
+ (and (..should_pass (text.of_char expected) /.lower)
+ (..should_fail (text.of_char invalid) /.lower))))
(do [! random.monad]
[expected (# ! each (n.% 10) random.nat)
invalid (random.char (unicode.set [unicode/block.number_forms (list)]))]
- (_.cover [/.decimal]
- (and (..should_pass (# n.decimal encoded expected) /.decimal)
- (..should_fail (text.of_char invalid) /.decimal))))
+ (_.coverage [/.decimal]
+ (and (..should_pass (# n.decimal encoded expected) /.decimal)
+ (..should_fail (text.of_char invalid) /.decimal))))
(do [! random.monad]
[expected (# ! each (n.% 8) random.nat)
invalid (random.char (unicode.set [unicode/block.number_forms (list)]))]
- (_.cover [/.octal]
- (and (..should_pass (# n.octal encoded expected) /.octal)
- (..should_fail (text.of_char invalid) /.octal))))
+ (_.coverage [/.octal]
+ (and (..should_pass (# n.octal encoded expected) /.octal)
+ (..should_fail (text.of_char invalid) /.octal))))
(do [! random.monad]
[expected (# ! each (n.% 16) random.nat)
invalid (random.char (unicode.set [unicode/block.number_forms (list)]))]
- (_.cover [/.hexadecimal]
- (and (..should_pass (# n.hex encoded expected) /.hexadecimal)
- (..should_fail (text.of_char invalid) /.hexadecimal))))
+ (_.coverage [/.hexadecimal]
+ (and (..should_pass (# n.hex encoded expected) /.hexadecimal)
+ (..should_fail (text.of_char invalid) /.hexadecimal))))
(do [! random.monad]
[expected (random.char unicode.alphabetic)
invalid (random.only (function (_ char)
(not (or (unicode/block.within? unicode/block.upper_case char)
(unicode/block.within? unicode/block.lower_case char))))
(random.char unicode.character))]
- (_.cover [/.alpha]
- (and (..should_pass (text.of_char expected) /.alpha)
- (..should_fail (text.of_char invalid) /.alpha))))
+ (_.coverage [/.alpha]
+ (and (..should_pass (text.of_char expected) /.alpha)
+ (..should_fail (text.of_char invalid) /.alpha))))
(do [! random.monad]
[expected (random.char unicode.alpha_numeric)
invalid (random.only (function (_ char)
@@ -131,9 +131,9 @@
(unicode/block.within? unicode/block.lower_case char)
(unicode/block.within? unicode/block.numeric char))))
(random.char unicode.character))]
- (_.cover [/.alpha_num]
- (and (..should_pass (text.of_char expected) /.alpha_num)
- (..should_fail (text.of_char invalid) /.alpha_num))))
+ (_.coverage [/.alpha_num]
+ (and (..should_pass (text.of_char expected) /.alpha_num)
+ (..should_fail (text.of_char invalid) /.alpha_num))))
(do [! random.monad]
[expected (all random.either
(in text.tab)
@@ -149,9 +149,9 @@
(text#= text.new_line char)
(text#= text.carriage_return char)
(text#= text.form_feed char))))))]
- (_.cover [/.space]
- (and (..should_pass expected /.space)
- (..should_fail invalid /.space))))
+ (_.coverage [/.space]
+ (and (..should_pass expected /.space)
+ (..should_fail invalid /.space))))
(do [! random.monad]
[.let [num_options 3]
options (|> (random.char unicode.character)
@@ -167,17 +167,17 @@
invalid (random.only (function (_ char)
(not (text.contains? (text.of_char char) options)))
(random.char unicode.character))]
- (_.cover [/.one_of /.one_of! /.character_should_be]
- (and (..should_pass (text.of_char expected) (/.one_of options))
- (..should_fail (text.of_char invalid) (/.one_of options))
- (..should_fail' (text.of_char invalid) (/.one_of options)
- /.character_should_be)
+ (_.coverage [/.one_of /.one_of! /.character_should_be]
+ (and (..should_pass (text.of_char expected) (/.one_of options))
+ (..should_fail (text.of_char invalid) (/.one_of options))
+ (..should_fail' (text.of_char invalid) (/.one_of options)
+ /.character_should_be)
- (..should_pass! (text.of_char expected) (/.one_of! options))
- (..should_fail (text.of_char invalid) (/.one_of! options))
- (..should_fail' (text.of_char invalid) (/.one_of! options)
- /.character_should_be)
- )))
+ (..should_pass! (text.of_char expected) (/.one_of! options))
+ (..should_fail (text.of_char invalid) (/.one_of! options))
+ (..should_fail' (text.of_char invalid) (/.one_of! options)
+ /.character_should_be)
+ )))
(do [! random.monad]
[.let [num_options 3]
options (|> (random.char unicode.character)
@@ -193,17 +193,17 @@
expected (random.only (function (_ char)
(not (text.contains? (text.of_char char) options)))
(random.char unicode.character))]
- (_.cover [/.none_of /.none_of! /.character_should_not_be]
- (and (..should_pass (text.of_char expected) (/.none_of options))
- (..should_fail (text.of_char invalid) (/.none_of options))
- (..should_fail' (text.of_char invalid) (/.none_of options)
- /.character_should_not_be)
+ (_.coverage [/.none_of /.none_of! /.character_should_not_be]
+ (and (..should_pass (text.of_char expected) (/.none_of options))
+ (..should_fail (text.of_char invalid) (/.none_of options))
+ (..should_fail' (text.of_char invalid) (/.none_of options)
+ /.character_should_not_be)
- (..should_pass! (text.of_char expected) (/.none_of! options))
- (..should_fail (text.of_char invalid) (/.none_of! options))
- (..should_fail' (text.of_char invalid) (/.none_of! options)
- /.character_should_not_be)
- )))
+ (..should_pass! (text.of_char expected) (/.none_of! options))
+ (..should_fail (text.of_char invalid) (/.none_of! options))
+ (..should_fail' (text.of_char invalid) (/.none_of! options)
+ /.character_should_not_be)
+ )))
))
(def: runs
@@ -218,11 +218,11 @@
(# ! each (n.% 16))
(random.only (n.>= 8))
(# ! each (# n.hex encoded)))]
- (_.cover [/.many /.many!]
- (and (..should_pass expected (/.many /.octal))
- (..should_fail invalid (/.many /.octal))
+ (_.coverage [/.many /.many!]
+ (and (..should_pass expected (/.many /.octal))
+ (..should_fail invalid (/.many /.octal))
- (..should_pass! expected (/.many! octal!)))))
+ (..should_pass! expected (/.many! octal!)))))
(do [! random.monad]
[left (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)
right (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)
@@ -231,65 +231,65 @@
(# ! each (n.% 16))
(random.only (n.>= 8))
(# ! each (# n.hex encoded)))]
- (_.cover [/.some /.some!]
- (and (..should_pass expected (/.some /.octal))
- (..should_pass "" (/.some /.octal))
- (..should_fail invalid (/.some /.octal))
+ (_.coverage [/.some /.some!]
+ (and (..should_pass expected (/.some /.octal))
+ (..should_pass "" (/.some /.octal))
+ (..should_fail invalid (/.some /.octal))
- (..should_pass! expected (/.some! octal!))
- (..should_pass! "" (/.some! octal!)))))
+ (..should_pass! expected (/.some! octal!))
+ (..should_pass! "" (/.some! octal!)))))
(do [! random.monad]
[.let [octal (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)]
first octal
second octal
third octal]
- (_.cover [/.exactly /.exactly!]
- (and (..should_pass (format first second) (/.exactly 2 /.octal))
- (..should_fail (format first second third) (/.exactly 2 /.octal))
- (..should_fail (format first) (/.exactly 2 /.octal))
+ (_.coverage [/.exactly /.exactly!]
+ (and (..should_pass (format first second) (/.exactly 2 /.octal))
+ (..should_fail (format first second third) (/.exactly 2 /.octal))
+ (..should_fail (format first) (/.exactly 2 /.octal))
- (..should_pass! (format first second) (/.exactly! 2 octal!))
- (..should_fail (format first second third) (/.exactly! 2 octal!))
- (..should_fail (format first) (/.exactly! 2 octal!)))))
+ (..should_pass! (format first second) (/.exactly! 2 octal!))
+ (..should_fail (format first second third) (/.exactly! 2 octal!))
+ (..should_fail (format first) (/.exactly! 2 octal!)))))
(do [! random.monad]
[.let [octal (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)]
first octal
second octal
third octal]
- (_.cover [/.at_most /.at_most!]
- (and (..should_pass (format first second) (/.at_most 2 /.octal))
- (..should_pass (format first) (/.at_most 2 /.octal))
- (..should_fail (format first second third) (/.at_most 2 /.octal))
+ (_.coverage [/.at_most /.at_most!]
+ (and (..should_pass (format first second) (/.at_most 2 /.octal))
+ (..should_pass (format first) (/.at_most 2 /.octal))
+ (..should_fail (format first second third) (/.at_most 2 /.octal))
- (..should_pass! (format first second) (/.at_most! 2 octal!))
- (..should_pass! (format first) (/.at_most! 2 octal!))
- (..should_fail (format first second third) (/.at_most! 2 octal!)))))
+ (..should_pass! (format first second) (/.at_most! 2 octal!))
+ (..should_pass! (format first) (/.at_most! 2 octal!))
+ (..should_fail (format first second third) (/.at_most! 2 octal!)))))
(do [! random.monad]
[.let [octal (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)]
first octal
second octal
third octal]
- (_.cover [/.at_least /.at_least!]
- (and (..should_pass (format first second) (/.at_least 2 /.octal))
- (..should_pass (format first second third) (/.at_least 2 /.octal))
- (..should_fail (format first) (/.at_least 2 /.octal))
+ (_.coverage [/.at_least /.at_least!]
+ (and (..should_pass (format first second) (/.at_least 2 /.octal))
+ (..should_pass (format first second third) (/.at_least 2 /.octal))
+ (..should_fail (format first) (/.at_least 2 /.octal))
- (..should_pass! (format first second) (/.at_least! 2 octal!))
- (..should_pass! (format first second third) (/.at_least! 2 octal!))
- (..should_fail (format first) (/.at_least! 2 octal!)))))
+ (..should_pass! (format first second) (/.at_least! 2 octal!))
+ (..should_pass! (format first second third) (/.at_least! 2 octal!))
+ (..should_fail (format first) (/.at_least! 2 octal!)))))
(do [! random.monad]
[.let [octal (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)]
first octal
second octal
third octal]
- (_.cover [/.between /.between!]
- (and (..should_pass (format first second) (/.between 2 1 /.octal))
- (..should_pass (format first second third) (/.between 2 1 /.octal))
- (..should_fail (format first) (/.between 2 1 /.octal))
+ (_.coverage [/.between /.between!]
+ (and (..should_pass (format first second) (/.between 2 1 /.octal))
+ (..should_pass (format first second third) (/.between 2 1 /.octal))
+ (..should_fail (format first) (/.between 2 1 /.octal))
- (..should_pass! (format first second) (/.between! 2 1 octal!))
- (..should_pass! (format first second third) (/.between! 2 1 octal!))
- (..should_fail (format first) (/.between! 2 1 octal!)))))
+ (..should_pass! (format first second) (/.between! 2 1 octal!))
+ (..should_pass! (format first second third) (/.between! 2 1 octal!))
+ (..should_fail (format first) (/.between! 2 1 octal!)))))
)))
(def: .public test
@@ -299,121 +299,121 @@
(all _.and
(do [! random.monad]
[sample (random.unicode 1)]
- (_.cover [/.result /.end]
- (and (|> (/.result /.end
- "")
- (!expect {try.#Success _}))
- (|> (/.result /.end
- sample)
- (!expect {try.#Failure _})))))
+ (_.coverage [/.result /.end]
+ (and (|> (/.result /.end
+ "")
+ (!expect {try.#Success _}))
+ (|> (/.result /.end
+ sample)
+ (!expect {try.#Failure _})))))
(do [! random.monad]
[.let [size 10]
expected (random.unicode size)
dummy (|> (random.unicode size)
(random.only (|>> (text#= expected) not)))]
- (_.cover [/.this /.cannot_match]
- (and (|> (/.result (/.this expected)
- expected)
- (!expect {try.#Success []}))
- (|> (/.result (/.this expected)
- dummy)
- (!expect (^.multi {try.#Failure error}
- (exception.match? /.cannot_match error)))))))
- (_.cover [/.Slice /.slice /.cannot_slice]
- (|> ""
- (/.result (/.slice /.any!))
+ (_.coverage [/.this /.cannot_match]
+ (and (|> (/.result (/.this expected)
+ expected)
+ (!expect {try.#Success []}))
+ (|> (/.result (/.this expected)
+ dummy)
(!expect (^.multi {try.#Failure error}
- (exception.match? /.cannot_slice error)))))
+ (exception.match? /.cannot_match error)))))))
+ (_.coverage [/.Slice /.slice /.cannot_slice]
+ (|> ""
+ (/.result (/.slice /.any!))
+ (!expect (^.multi {try.#Failure error}
+ (exception.match? /.cannot_slice error)))))
(do [! random.monad]
[expected (random.unicode 1)]
- (_.cover [/.any /.any!]
- (and (..should_pass expected /.any)
- (..should_fail "" /.any)
+ (_.coverage [/.any /.any!]
+ (and (..should_pass expected /.any)
+ (..should_fail "" /.any)
- (..should_pass! expected /.any!)
- (..should_fail "" /.any!))))
+ (..should_pass! expected /.any!)
+ (..should_fail "" /.any!))))
(do [! random.monad]
[expected (random.unicode 1)]
- (_.cover [/.next /.cannot_parse]
- (and (..should_pass expected (<>.before /.any /.next))
- (|> ""
- (/.result (<>.before /.any /.next))
- (!expect (^.multi {try.#Failure error}
- (exception.match? /.cannot_parse error)))))))
+ (_.coverage [/.next /.cannot_parse]
+ (and (..should_pass expected (<>.before /.any /.next))
+ (|> ""
+ (/.result (<>.before /.any /.next))
+ (!expect (^.multi {try.#Failure error}
+ (exception.match? /.cannot_parse error)))))))
(do [! random.monad]
[dummy (random.unicode 1)]
- (_.cover [/.unconsumed_input]
- (|> (format dummy dummy)
- (/.result /.any)
- (!expect (^.multi {try.#Failure error}
- (exception.match? /.unconsumed_input error))))))
+ (_.coverage [/.unconsumed_input]
+ (|> (format dummy dummy)
+ (/.result /.any)
+ (!expect (^.multi {try.#Failure error}
+ (exception.match? /.unconsumed_input error))))))
(do [! random.monad]
[sample (random.unicode 1)]
- (_.cover [/.Offset /.offset]
- (|> sample
- (/.result (do <>.monad
- [pre /.offset
- _ /.any
- post /.offset]
- (in [pre post])))
- (!expect {try.#Success [0 1]}))))
+ (_.coverage [/.Offset /.offset]
+ (|> sample
+ (/.result (do <>.monad
+ [pre /.offset
+ _ /.any
+ post /.offset]
+ (in [pre post])))
+ (!expect {try.#Success [0 1]}))))
(do [! random.monad]
[left (random.unicode 1)
right (random.unicode 1)
.let [input (format left right)]]
- (_.cover [/.remaining]
- (|> input
- (/.result (do <>.monad
- [pre /.remaining
- _ /.any
- post /.remaining
- _ /.any]
- (in (and (text#= input pre)
- (text#= right post)))))
- (!expect {try.#Success #1}))))
+ (_.coverage [/.remaining]
+ (|> input
+ (/.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)
right (random.unicode 1)
expected (random.only (|>> (text#= right) not)
(random.unicode 1))]
- (_.cover [/.enclosed]
- (|> (format left expected right)
- (/.result (/.enclosed [left right] (/.this expected)))
- (!expect {try.#Success _}))))
+ (_.coverage [/.enclosed]
+ (|> (format left expected right)
+ (/.result (/.enclosed [left right] (/.this expected)))
+ (!expect {try.#Success _}))))
(do [! random.monad]
[input (random.unicode 1)
output (random.unicode 1)]
- (_.cover [/.local]
- (|> output
- (/.result (do <>.monad
- [_ (/.local input (/.this input))]
- (/.this output)))
- (!expect {try.#Success _}))))
+ (_.coverage [/.local]
+ (|> output
+ (/.result (do <>.monad
+ [_ (/.local input (/.this input))]
+ (/.this output)))
+ (!expect {try.#Success _}))))
(do [! random.monad]
[expected (# ! each (|>> (n.% 8) (# n.octal encoded)) random.nat)]
- (_.cover [/.then]
- (|> (list (code.text expected))
- (<c>.result (/.then /.octal <c>.text))
- (!expect (^.multi {try.#Success actual}
- (text#= expected actual))))))
+ (_.coverage [/.then]
+ (|> (list (code.text expected))
+ (<c>.result (/.then /.octal <c>.text))
+ (!expect (^.multi {try.#Success actual}
+ (text#= expected actual))))))
(do [! random.monad]
[invalid (random.upper_case 1)
expected (random.only (|>> (unicode/block.within? unicode/block.upper_case)
not)
(random.char unicode.character))
.let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]]
- (_.cover [/.not /.not! /.expected_to_fail]
- (and (..should_pass (text.of_char expected) (/.not /.upper))
- (|> invalid
- (/.result (/.not /.upper))
- (!expect (^.multi {try.#Failure error}
- (exception.match? /.expected_to_fail error))))
+ (_.coverage [/.not /.not! /.expected_to_fail]
+ (and (..should_pass (text.of_char expected) (/.not /.upper))
+ (|> invalid
+ (/.result (/.not /.upper))
+ (!expect (^.multi {try.#Failure error}
+ (exception.match? /.expected_to_fail error))))
- (..should_pass! (text.of_char expected) (/.not! upper!))
- (|> invalid
- (/.result (/.not! upper!))
- (!expect (^.multi {try.#Failure error}
- (exception.match? /.expected_to_fail error)))))))
+ (..should_pass! (text.of_char expected) (/.not! upper!))
+ (|> invalid
+ (/.result (/.not! upper!))
+ (!expect (^.multi {try.#Failure error}
+ (exception.match? /.expected_to_fail error)))))))
(do [! random.monad]
[upper (random.upper_case 1)
lower (random.lower_case 1)
@@ -423,21 +423,21 @@
(random.char unicode.character))
.let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
lower! (/.one_of! "abcdefghijklmnopqrstuvwxyz")]]
- (_.cover [/.and /.and!]
- (and (..should_pass (format upper lower) (/.and /.upper /.lower))
- (..should_fail (format (text.of_char invalid) lower) (/.and /.upper /.lower))
- (..should_fail (format upper (text.of_char invalid)) (/.and /.upper /.lower))
+ (_.coverage [/.and /.and!]
+ (and (..should_pass (format upper lower) (/.and /.upper /.lower))
+ (..should_fail (format (text.of_char invalid) lower) (/.and /.upper /.lower))
+ (..should_fail (format upper (text.of_char invalid)) (/.and /.upper /.lower))
- (..should_pass! (format upper lower) (/.and! upper! lower!))
- (..should_fail (format (text.of_char invalid) lower) (/.and! upper! lower!))
- (..should_fail (format upper (text.of_char invalid)) (/.and! upper! lower!)))))
+ (..should_pass! (format upper lower) (/.and! upper! lower!))
+ (..should_fail (format (text.of_char invalid) lower) (/.and! upper! lower!))
+ (..should_fail (format upper (text.of_char invalid)) (/.and! upper! lower!)))))
(do [! random.monad]
[expected (random.unicode 1)
invalid (random.unicode 1)]
- (_.cover [/.satisfies /.character_does_not_satisfy_predicate]
- (and (..should_pass expected (/.satisfies (function.constant true)))
- (..should_fail' invalid (/.satisfies (function.constant false))
- /.character_does_not_satisfy_predicate))))
+ (_.coverage [/.satisfies /.character_does_not_satisfy_predicate]
+ (and (..should_pass expected (/.satisfies (function.constant true)))
+ (..should_fail' invalid (/.satisfies (function.constant false))
+ /.character_does_not_satisfy_predicate))))
..character_classes
..runs
)))