From bb2ec42843ba0f13adafe1f2f4a7b2820fbcaafa Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 13 May 2018 12:59:13 -0400 Subject: - Added dedicated unicode support for text. - Minor refactoring. --- stdlib/test/test/lux.lux | 4 ++-- stdlib/test/test/lux/cli.lux | 2 +- stdlib/test/test/lux/data/format/json.lux | 12 ++++++------ stdlib/test/test/lux/data/format/xml.lux | 2 +- stdlib/test/test/lux/data/ident.lux | 2 +- stdlib/test/test/lux/data/text.lux | 14 +++++++------- stdlib/test/test/lux/data/text/lexer.lux | 4 ++-- stdlib/test/test/lux/data/text/regex.lux | 6 +++--- stdlib/test/test/lux/lang/syntax.lux | 6 +++--- stdlib/test/test/lux/lang/type.lux | 2 +- stdlib/test/test/lux/lang/type/check.lux | 2 +- stdlib/test/test/lux/macro/poly/equality.lux | 4 ++-- 12 files changed, 30 insertions(+), 30 deletions(-) (limited to 'stdlib/test') diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index 1f0a6e115..3c731ebc4 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -15,8 +15,8 @@ (<| (times +100) (do @ [size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +10)))) - x (r.text size) - y (r.text size)] + x (r.unicode size) + y (r.unicode size)] ($_ seq (test "Every value is identical to itself, and the 'id' function doesn't change values in any way." (and (is? x x) diff --git a/stdlib/test/test/lux/cli.lux b/stdlib/test/test/lux/cli.lux index b5f251c57..4aed244b2 100644 --- a/stdlib/test/test/lux/cli.lux +++ b/stdlib/test/test/lux/cli.lux @@ -22,7 +22,7 @@ #let [(^open "Nat/") number.Codec gen-arg (:: @ map Nat/encode r.nat)] yes gen-arg - #let [gen-ignore (|> (r.text +5) (r.filter (|>> (text/= yes) not)))] + #let [gen-ignore (|> (r.unicode +5) (r.filter (|>> (text/= yes) not)))] no gen-ignore pre-ignore (r.list +5 gen-ignore) post-ignore (r.list +5 gen-ignore)] diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index 43b0851c0..a8a117a04 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -42,9 +42,9 @@ (:: @ wrap []) r.bool (|> r.frac (:: @ map (f/* 1_000_000.0))) - (r.text size) + (r.unicode size) (r.sequence size gen-json) - (r.dict text.Hash size (r.text size) gen-json) + (r.dict text.Hash size (r.unicode size) gen-json) ))))) (context: "JSON" @@ -110,12 +110,12 @@ ($_ r.seq r.bool r.frac - (r.text size) + (r.unicode size) (r.maybe r.frac) (r.list size r.frac) - (r.dict text.Hash size (r.text size) r.frac) - ## ($_ r.alt r.bool (r.text size) r.frac) - ## ($_ r.seq r.bool r.frac (r.text size)) + (r.dict text.Hash size (r.unicode size) r.frac) + ## ($_ r.alt r.bool (r.unicode size) r.frac) + ## ($_ r.seq r.bool r.frac (r.unicode size)) gen-recursive ## _instant.instant _duration.duration diff --git a/stdlib/test/test/lux/data/format/xml.lux b/stdlib/test/test/lux/data/format/xml.lux index d70b911dc..b7377ab64 100644 --- a/stdlib/test/test/lux/data/format/xml.lux +++ b/stdlib/test/test/lux/data/format/xml.lux @@ -37,7 +37,7 @@ (-> Nat Nat (r.Random Text)) (do r.Monad [size (size^ bottom top)] - (r.text' xml-char^ size))) + (r.text xml-char^ size))) (def: xml-identifier^ (r.Random Ident) diff --git a/stdlib/test/test/lux/data/ident.lux b/stdlib/test/test/lux/data/ident.lux index d6732619e..5e39bad7f 100644 --- a/stdlib/test/test/lux/data/ident.lux +++ b/stdlib/test/test/lux/data/ident.lux @@ -11,7 +11,7 @@ (def: (gen-part size) (-> Nat (r.Random Text)) - (|> (r.text size) (r.filter (|>> (text.contains? ".") not)))) + (|> (r.unicode size) (r.filter (|>> (text.contains? ".") not)))) (context: "Idents" (<| (times +100) diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux index 2430c9919..99c750f74 100644 --- a/stdlib/test/test/lux/data/text.lux +++ b/stdlib/test/test/lux/data/text.lux @@ -14,7 +14,7 @@ (<| (times +100) (do @ [size (:: @ map (n/% +100) r.nat) - sample (r.text size)] + sample (r.unicode size)] (test "" (or (and (n/= +0 size) (&.empty? sample)) (n/= size (&.size sample))))))) @@ -29,7 +29,7 @@ (do @ [size bounded-size idx (:: @ map (n/% size) r.nat) - sample (r.text size)] + sample (r.unicode size)] (test "" (|> sample (&.nth idx) (case> (^multi (#.Some char) @@ -58,8 +58,8 @@ (do @ [sizeL bounded-size sizeR bounded-size - sampleL (r.text sizeL) - sampleR (r.text sizeR) + sampleL (r.unicode sizeL) + sampleR (r.unicode sizeR) #let [sample (&.concat (list sampleL sampleR)) fake-sample (&.join-with " " (list sampleL sampleR)) dup-sample (&.join-with "" (list sampleL sampleR)) @@ -105,9 +105,9 @@ ## can make text replacement work improperly. ## Because of that, I restrict the charset. normal-char-gen (|> r.nat (:: @ map (|>> (n/% +128) (n/max +1))))] - sep1 (r.text' normal-char-gen +1) - sep2 (r.text' normal-char-gen +1) - #let [part-gen (|> (r.text' normal-char-gen sizeP) + sep1 (r.text normal-char-gen +1) + sep2 (r.text normal-char-gen +1) + #let [part-gen (|> (r.text normal-char-gen sizeP) (r.filter (|>> (&.contains? sep1) not)))] parts (r.list sizeL part-gen) #let [sample1 (&.concat (list.interpose sep1 parts)) diff --git a/stdlib/test/test/lux/data/text/lexer.lux b/stdlib/test/test/lux/data/text/lexer.lux index 8706e2f2e..58e142a98 100644 --- a/stdlib/test/test/lux/data/text/lexer.lux +++ b/stdlib/test/test/lux/data/text/lexer.lux @@ -73,8 +73,8 @@ (<| (times +100) (do @ [size (|> r.nat (:: @ map (|>> (n/% +100) (n/max +10)))) - sample (r.text size) - non-sample (|> (r.text size) + sample (r.unicode size) + non-sample (|> (r.unicode size) (r.filter (|>> (text/= sample) not)))] ($_ seq (test "Can find literal text fragments." diff --git a/stdlib/test/test/lux/data/text/regex.lux b/stdlib/test/test/lux/data/text/regex.lux index 7323aeb79..7bc3082a1 100644 --- a/stdlib/test/test/lux/data/text/regex.lux +++ b/stdlib/test/test/lux/data/text/regex.lux @@ -269,9 +269,9 @@ (context: "Pattern-matching" (<| (times +100) (do @ - [sample1 (r.text +3) - sample2 (r.text +3) - sample3 (r.text +4)] + [sample1 (r.unicode +3) + sample2 (r.unicode +3) + sample3 (r.unicode +4)] (case (format sample1 "-" sample2 "-" sample3) (&.^regex "(.{3})-(.{3})-(.{4})" [_ match1 match2 match3]) diff --git a/stdlib/test/test/lux/lang/syntax.lux b/stdlib/test/test/lux/lang/syntax.lux index 01679b27a..0645bfe25 100644 --- a/stdlib/test/test/lux/lang/syntax.lux +++ b/stdlib/test/test/lux/lang/syntax.lux @@ -33,7 +33,7 @@ (not (text.contains? (text.from-code sample) invalid-range)))))] size (|> r.nat (:: @ map (|>> (n/% +20) (n/max +1))))] - (r.text' char-gen size))) + (r.text char-gen size))) (def: ident^ (r.Random Ident) @@ -52,7 +52,7 @@ ($_ r.either (do r.Monad [size (|> r.nat (r/map (n/% +20)))] - (|> (r.text size) (r/map code.text))) + (|> (r.unicode size) (r/map code.text))) (|> ident^ (r/map code.symbol)) (|> ident^ (r/map code.tag)))) simple^ (: (r.Random Code) @@ -152,7 +152,7 @@ (n/= (char ")") value))))))] (do r.Monad [size (|> r.nat (r/map (n/% +20)))] - (r.text' char-gen size)))) + (r.text char-gen size)))) (def: comment^ (r.Random Text) diff --git a/stdlib/test/test/lux/lang/type.lux b/stdlib/test/test/lux/lang/type.lux index 0c7fa84be..be888d321 100644 --- a/stdlib/test/test/lux/lang/type.lux +++ b/stdlib/test/test/lux/lang/type.lux @@ -17,7 +17,7 @@ (r.Random Text) (do r.Monad [size (|> r.nat (:: @ map (n/% +10)))] - (r.text size))) + (r.unicode size))) (def: gen-ident (r.Random Ident) diff --git a/stdlib/test/test/lux/lang/type/check.lux b/stdlib/test/test/lux/lang/type/check.lux index 517b2561b..b384ad2ef 100644 --- a/stdlib/test/test/lux/lang/type/check.lux +++ b/stdlib/test/test/lux/lang/type/check.lux @@ -20,7 +20,7 @@ (r.Random Text) (do r.Monad [size (|> r.nat (:: @ map (n/% +10)))] - (r.text size))) + (r.unicode size))) (def: gen-ident (r.Random Ident) diff --git a/stdlib/test/test/lux/macro/poly/equality.lux b/stdlib/test/test/lux/macro/poly/equality.lux index beb203bcb..832c72355 100644 --- a/stdlib/test/test/lux/macro/poly/equality.lux +++ b/stdlib/test/test/lux/macro/poly/equality.lux @@ -51,11 +51,11 @@ r.bool gen-int r.frac - (r.text size) + (r.unicode size) (r.maybe gen-int) (r.list size gen-int) ($_ r.alt r.bool gen-int r.frac) - ($_ r.seq gen-int r.frac (r.text size)) + ($_ r.seq gen-int r.frac (r.unicode size)) gen-recursive))) (derived: (&.Eq Record)) -- cgit v1.2.3