diff options
Diffstat (limited to 'stdlib/source/test/lux/control/parser/text.lux')
-rw-r--r-- | stdlib/source/test/lux/control/parser/text.lux | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index d00a21d90..46e0d4bda 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -75,64 +75,64 @@ [offset (\ ! map (n.% 50) random.nat) range (\ ! map (|>> (n.% 50) (n.+ 10)) random.nat) #let [limit (n.+ offset range)] - expected (\ ! map (|>> (n.% range) (n.+ offset) text.from_code) random.nat) + expected (\ ! map (|>> (n.% range) (n.+ offset) text.of_code) random.nat) out_of_range (case offset - 0 (\ ! map (|>> (n.% 10) inc (n.+ limit) text.from_code) random.nat) - _ (\ ! map (|>> (n.% offset) text.from_code) random.nat))] + 0 (\ ! map (|>> (n.% 10) inc (n.+ limit) text.of_code) random.nat) + _ (\ ! map (|>> (n.% offset) text.of_code) random.nat))] (_.cover [/.range] (and (..should_pass expected (/.range offset limit)) (..should_fail out_of_range (/.range offset limit))))) (do {! random.monad} [expected (random.char unicode.ascii/upper) - invalid (random.filter (|>> (unicode/block.within? unicode/block.basic_latin/upper) not) - (random.char unicode.character))] + invalid (random.only (|>> (unicode/block.within? unicode/block.basic_latin/upper) not) + (random.char unicode.character))] (_.cover [/.upper] - (and (..should_pass (text.from_code expected) /.upper) - (..should_fail (text.from_code invalid) /.upper)))) + (and (..should_pass (text.of_code expected) /.upper) + (..should_fail (text.of_code invalid) /.upper)))) (do {! random.monad} [expected (random.char unicode.ascii/lower) - invalid (random.filter (|>> (unicode/block.within? unicode/block.basic_latin/lower) not) - (random.char unicode.character))] + invalid (random.only (|>> (unicode/block.within? unicode/block.basic_latin/lower) not) + (random.char unicode.character))] (_.cover [/.lower] - (and (..should_pass (text.from_code expected) /.lower) - (..should_fail (text.from_code invalid) /.lower)))) + (and (..should_pass (text.of_code expected) /.lower) + (..should_fail (text.of_code invalid) /.lower)))) (do {! random.monad} [expected (\ ! map (n.% 10) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] (_.cover [/.decimal] (and (..should_pass (\ n.decimal encode expected) /.decimal) - (..should_fail (text.from_code invalid) /.decimal)))) + (..should_fail (text.of_code invalid) /.decimal)))) (do {! random.monad} [expected (\ ! map (n.% 8) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] (_.cover [/.octal] (and (..should_pass (\ n.octal encode expected) /.octal) - (..should_fail (text.from_code invalid) /.octal)))) + (..should_fail (text.of_code invalid) /.octal)))) (do {! random.monad} [expected (\ ! map (n.% 16) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] (_.cover [/.hexadecimal] (and (..should_pass (\ n.hex encode expected) /.hexadecimal) - (..should_fail (text.from_code invalid) /.hexadecimal)))) + (..should_fail (text.of_code invalid) /.hexadecimal)))) (do {! random.monad} [expected (random.char unicode.ascii/alpha) - invalid (random.filter (function (_ char) - (not (or (unicode/block.within? unicode/block.basic_latin/upper char) - (unicode/block.within? unicode/block.basic_latin/lower char)))) - (random.char unicode.character))] + invalid (random.only (function (_ char) + (not (or (unicode/block.within? unicode/block.basic_latin/upper char) + (unicode/block.within? unicode/block.basic_latin/lower char)))) + (random.char unicode.character))] (_.cover [/.alpha] - (and (..should_pass (text.from_code expected) /.alpha) - (..should_fail (text.from_code invalid) /.alpha)))) + (and (..should_pass (text.of_code expected) /.alpha) + (..should_fail (text.of_code invalid) /.alpha)))) (do {! random.monad} [expected (random.char unicode.ascii/alpha_num) - invalid (random.filter (function (_ char) - (not (or (unicode/block.within? unicode/block.basic_latin/upper char) - (unicode/block.within? unicode/block.basic_latin/lower char) - (unicode/block.within? unicode/block.basic_latin/decimal char)))) - (random.char unicode.character))] + invalid (random.only (function (_ char) + (not (or (unicode/block.within? unicode/block.basic_latin/upper char) + (unicode/block.within? unicode/block.basic_latin/lower char) + (unicode/block.within? unicode/block.basic_latin/decimal char)))) + (random.char unicode.character))] (_.cover [/.alpha_num] - (and (..should_pass (text.from_code expected) /.alpha_num) - (..should_fail (text.from_code invalid) /.alpha_num)))) + (and (..should_pass (text.of_code expected) /.alpha_num) + (..should_fail (text.of_code invalid) /.alpha_num)))) (do {! random.monad} [expected ($_ random.either (wrap text.tab) @@ -141,13 +141,13 @@ (wrap text.new_line) (wrap text.carriage_return) (wrap text.form_feed)) - invalid (|> (random.unicode 1) (random.filter (function (_ char) - (not (or (text\= text.tab char) - (text\= text.vertical_tab char) - (text\= text.space char) - (text\= text.new_line char) - (text\= text.carriage_return char) - (text\= text.form_feed char))))))] + invalid (|> (random.unicode 1) (random.only (function (_ char) + (not (or (text\= text.tab char) + (text\= text.vertical_tab char) + (text\= text.space char) + (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)))) @@ -156,25 +156,25 @@ options (|> (random.char unicode.character) (random.set n.hash num_options) (\ ! map (|>> set.to_list - (list\map text.from_code) + (list\map text.of_code) (text.join_with "")))) expected (\ ! map (function (_ value) (|> options (text.nth (n.% num_options value)) maybe.assume)) random.nat) - invalid (random.filter (function (_ char) - (not (text.contains? (text.from_code char) options))) - (random.char unicode.character))] + invalid (random.only (function (_ char) + (not (text.contains? (text.of_code char) options))) + (random.char unicode.character))] (_.cover [/.one_of /.one_of! /.character_should_be] - (and (..should_pass (text.from_code expected) (/.one_of options)) - (..should_fail (text.from_code invalid) (/.one_of options)) - (..should_fail' (text.from_code invalid) (/.one_of options) + (and (..should_pass (text.of_code expected) (/.one_of options)) + (..should_fail (text.of_code invalid) (/.one_of options)) + (..should_fail' (text.of_code invalid) (/.one_of options) /.character_should_be) - (..should_pass! (text.from_code expected) (/.one_of! options)) - (..should_fail (text.from_code invalid) (/.one_of! options)) - (..should_fail' (text.from_code invalid) (/.one_of! options) + (..should_pass! (text.of_code expected) (/.one_of! options)) + (..should_fail (text.of_code invalid) (/.one_of! options)) + (..should_fail' (text.of_code invalid) (/.one_of! options) /.character_should_be) ))) (do {! random.monad} @@ -182,25 +182,25 @@ options (|> (random.char unicode.character) (random.set n.hash num_options) (\ ! map (|>> set.to_list - (list\map text.from_code) + (list\map text.of_code) (text.join_with "")))) invalid (\ ! map (function (_ value) (|> options (text.nth (n.% num_options value)) maybe.assume)) random.nat) - expected (random.filter (function (_ char) - (not (text.contains? (text.from_code char) options))) - (random.char unicode.character))] + expected (random.only (function (_ char) + (not (text.contains? (text.of_code char) options))) + (random.char unicode.character))] (_.cover [/.none_of /.none_of! /.character_should_not_be] - (and (..should_pass (text.from_code expected) (/.none_of options)) - (..should_fail (text.from_code invalid) (/.none_of options)) - (..should_fail' (text.from_code invalid) (/.none_of options) + (and (..should_pass (text.of_code expected) (/.none_of options)) + (..should_fail (text.of_code invalid) (/.none_of options)) + (..should_fail' (text.of_code invalid) (/.none_of options) /.character_should_not_be) - (..should_pass! (text.from_code expected) (/.none_of! options)) - (..should_fail (text.from_code invalid) (/.none_of! options)) - (..should_fail' (text.from_code invalid) (/.none_of! options) + (..should_pass! (text.of_code expected) (/.none_of! options)) + (..should_fail (text.of_code invalid) (/.none_of! options)) + (..should_fail' (text.of_code invalid) (/.none_of! options) /.character_should_not_be) ))) )) @@ -215,7 +215,7 @@ #let [expected (format left right)] invalid (|> random.nat (\ ! map (n.% 16)) - (random.filter (n.>= 8)) + (random.only (n.>= 8)) (\ ! map (\ n.hex encode)))] (_.cover [/.many /.many!] (and (..should_pass expected (/.many /.octal)) @@ -228,7 +228,7 @@ #let [expected (format left right)] invalid (|> random.nat (\ ! map (n.% 16)) - (random.filter (n.>= 8)) + (random.only (n.>= 8)) (\ ! map (\ n.hex encode)))] (_.cover [/.some /.some!] (and (..should_pass expected (/.some /.octal)) @@ -309,7 +309,7 @@ [#let [size 10] expected (random.unicode size) dummy (|> (random.unicode size) - (random.filter (|>> (text\= expected) not)))] + (random.only (|>> (text\= expected) not)))] (_.cover [/.this /.cannot_match] (and (|> (/.run (/.this expected) expected) @@ -373,8 +373,8 @@ (do {! random.monad} [left (random.unicode 1) right (random.unicode 1) - expected (random.filter (|>> (text\= right) not) - (random.unicode 1))] + expected (random.only (|>> (text\= right) not) + (random.unicode 1))] (_.cover [/.enclosed] (|> (format left expected right) (/.run (/.enclosed [left right] (/.this expected))) @@ -397,18 +397,18 @@ (text\= expected actual)))))) (do {! random.monad} [invalid (random.ascii/upper 1) - expected (random.filter (|>> (unicode/block.within? unicode/block.basic_latin/upper) - not) - (random.char unicode.character)) + expected (random.only (|>> (unicode/block.within? unicode/block.basic_latin/upper) + not) + (random.char unicode.character)) #let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]] (_.cover [/.not /.not! /.expected_to_fail] - (and (..should_pass (text.from_code expected) (/.not /.upper)) + (and (..should_pass (text.of_code expected) (/.not /.upper)) (|> invalid (/.run (/.not /.upper)) (!expect (^multi (#try.Failure error) (exception.match? /.expected_to_fail error)))) - (..should_pass! (text.from_code expected) (/.not! upper!)) + (..should_pass! (text.of_code expected) (/.not! upper!)) (|> invalid (/.run (/.not! upper!)) (!expect (^multi (#try.Failure error) @@ -416,20 +416,20 @@ (do {! random.monad} [upper (random.ascii/upper 1) lower (random.ascii/lower 1) - invalid (random.filter (function (_ char) - (not (or (unicode/block.within? unicode/block.basic_latin/upper char) - (unicode/block.within? unicode/block.basic_latin/lower char)))) - (random.char unicode.character)) + invalid (random.only (function (_ char) + (not (or (unicode/block.within? unicode/block.basic_latin/upper char) + (unicode/block.within? unicode/block.basic_latin/lower char)))) + (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.from_code invalid) lower) (/.and /.upper /.lower)) - (..should_fail (format upper (text.from_code invalid)) (/.and /.upper /.lower)) + (..should_fail (format (text.of_code invalid) lower) (/.and /.upper /.lower)) + (..should_fail (format upper (text.of_code invalid)) (/.and /.upper /.lower)) (..should_pass! (format upper lower) (/.and! upper! lower!)) - (..should_fail (format (text.from_code invalid) lower) (/.and! upper! lower!)) - (..should_fail (format upper (text.from_code invalid)) (/.and! upper! lower!))))) + (..should_fail (format (text.of_code invalid) lower) (/.and! upper! lower!)) + (..should_fail (format upper (text.of_code invalid)) (/.and! upper! lower!))))) (do {! random.monad} [expected (random.unicode 1) invalid (random.unicode 1)] |