aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/control/parser/binary.lux21
-rw-r--r--stdlib/source/test/lux/data/format/tar.lux5
-rw-r--r--stdlib/source/test/lux/data/text/encoding.lux11
-rw-r--r--stdlib/source/test/lux/data/text/encoding/utf8.lux19
4 files changed, 39 insertions, 17 deletions
diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux
index bc54ceada..943b8b3d5 100644
--- a/stdlib/source/test/lux/control/parser/binary.lux
+++ b/stdlib/source/test/lux/control/parser/binary.lux
@@ -18,8 +18,9 @@
["." bit]
["." name]
["." text ("#\." equivalence)
- ["." encoding]
- ["%" format (#+ format)]]
+ ["%" format (#+ format)]
+ [encoding
+ ["." utf8]]]
["." format #_
["#" binary]]
[collection
@@ -52,8 +53,8 @@
(def: (utf8_conversion_does_not_alter? value)
(Predicate Text)
(|> value
- (\ encoding.utf8 encode)
- (\ encoding.utf8 decode)
+ (\ utf8.codec encode)
+ (\ utf8.codec decode)
(case> (#try.Success converted)
(text\= value converted)
@@ -146,7 +147,7 @@
(`` ($_ _.and
(~~ (template [<parser> <format>]
[(do {! random.monad}
- [expected (\ ! map (\ encoding.utf8 encode) (random.ascii ..segment_size))]
+ [expected (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
(_.cover [<parser> <format>]
(|> (format.run <format> expected)
(/.run <parser>)
@@ -327,14 +328,14 @@
(/.run /.any)
(!expect (#try.Success _))))
(do {! random.monad}
- [data (\ ! map (\ encoding.utf8 encode) (random.ascii ..segment_size))]
+ [data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
(_.cover [/.binary_was_not_fully_read]
(|> data
(/.run /.any)
(!expect (^multi (#try.Failure error)
(exception.match? /.binary_was_not_fully_read error))))))
(do {! random.monad}
- [expected (\ ! map (\ encoding.utf8 encode) (random.ascii ..segment_size))]
+ [expected (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
(_.cover [/.segment format.segment format.run]
(|> expected
(format.run (format.segment ..segment_size))
@@ -342,7 +343,7 @@
(!expect (^multi (#try.Success actual)
(\ binary.equivalence = expected actual))))))
(do {! random.monad}
- [data (\ ! map (\ encoding.utf8 encode) (random.ascii ..segment_size))]
+ [data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
(_.cover [/.end?]
(|> data
(/.run (do <>.monad
@@ -354,7 +355,7 @@
(!expect (#try.Success #1)))))
(do {! random.monad}
[to_read (\ ! map (n.% (inc ..segment_size)) random.nat)
- data (\ ! map (\ encoding.utf8 encode) (random.ascii ..segment_size))]
+ data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
(_.cover [/.Offset /.offset]
(|> data
(/.run (do <>.monad
@@ -369,7 +370,7 @@
(!expect (#try.Success #1)))))
(do {! random.monad}
[to_read (\ ! map (n.% (inc ..segment_size)) random.nat)
- data (\ ! map (\ encoding.utf8 encode) (random.ascii ..segment_size))]
+ data (\ ! map (\ utf8.codec encode) (random.ascii ..segment_size))]
(_.cover [/.remaining]
(|> data
(/.run (do <>.monad
diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux
index c842ebe9c..c7250a025 100644
--- a/stdlib/source/test/lux/data/format/tar.lux
+++ b/stdlib/source/test/lux/data/format/tar.lux
@@ -14,7 +14,8 @@
["." binary ("#\." equivalence monoid)]
["." text ("#\." equivalence)
["%" format (#+ format)]
- ["." encoding]
+ [encoding
+ ["." utf8]]
["." unicode #_
["#" set]
["#/." block]]]
@@ -163,7 +164,7 @@
#let [content (|> chunk
(list.repeat chunks)
(text.join_with "")
- (\ encoding.utf8 encode))]]
+ (\ utf8.codec encode))]]
(`` ($_ _.and
(~~ (template [<type> <tag>]
[(_.cover [<type>]
diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux
index 9a9ba67cf..b4e47d7ee 100644
--- a/stdlib/source/test/lux/data/text/encoding.lux
+++ b/stdlib/source/test/lux/data/text/encoding.lux
@@ -21,7 +21,9 @@
[number
["n" nat]]]]
{1
- ["." /]})
+ ["." /]}
+ ["." / #_
+ ["#." utf8]])
(with_expansions [<encodings> (as_is [all/a
[/.ascii]]
@@ -68,7 +70,7 @@
/.ibm_874
/.ibm_875]]
- [all/ibm>900
+ [all/ibm<1000
[/.ibm_918
/.ibm_921
/.ibm_922
@@ -220,12 +222,11 @@
(<| (_.covering /._)
(_.for [/.Encoding])
(`` ($_ _.and
- (_.for [/.utf8]
- ($codec.spec text.equivalence /.utf8 (random.unicode 5)))
-
(~~ (template [<definition> <by_letter>]
[<definition>]
<encodings>))
+
+ /utf8.test
))))
)
diff --git a/stdlib/source/test/lux/data/text/encoding/utf8.lux b/stdlib/source/test/lux/data/text/encoding/utf8.lux
new file mode 100644
index 000000000..3d376811d
--- /dev/null
+++ b/stdlib/source/test/lux/data/text/encoding/utf8.lux
@@ -0,0 +1,19 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ {[0 #spec]
+ [/
+ ["$." codec]]}]
+ [data
+ ["." text]]
+ [math
+ ["." random (#+ Random)]]]
+ {1
+ ["." /]})
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.codec]
+ ($codec.spec text.equivalence /.codec (random.unicode 5)))))