aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world
diff options
context:
space:
mode:
authorEduardo Julian2022-10-24 19:28:57 -0400
committerEduardo Julian2022-10-24 19:28:57 -0400
commit8d4c256f8b56561869c14df02db695d774c74fa6 (patch)
tree3acdc7e92008bbe8a74e84610ea4daebd292678a /stdlib/source/test/lux/world
parent45c599e49ae2659331d13222948f7e755967fdf9 (diff)
Minor naming & syntax improvements.
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/world/file.lux4
-rw-r--r--stdlib/source/test/lux/world/net.lux3
-rw-r--r--stdlib/source/test/lux/world/net/http/client.lux2
-rw-r--r--stdlib/source/test/lux/world/net/http/cookie.lux12
-rw-r--r--stdlib/source/test/lux/world/net/http/header.lux13
-rw-r--r--stdlib/source/test/lux/world/net/mime.lux134
-rw-r--r--stdlib/source/test/lux/world/net/uri/encoding.lux8
-rw-r--r--stdlib/source/test/lux/world/net/uri/path.lux2
-rw-r--r--stdlib/source/test/lux/world/time/day.lux2
-rw-r--r--stdlib/source/test/lux/world/time/month.lux2
10 files changed, 160 insertions, 22 deletions
diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux
index 477b09110..35402d81a 100644
--- a/stdlib/source/test/lux/world/file.lux
+++ b/stdlib/source/test/lux/world/file.lux
@@ -246,8 +246,8 @@
Test
(<| (_.covering /._)
(do [! random.monad]
- [/ (random.upper_case 1)
- file (random.lower_case 1)]
+ [/ (random.upper_cased 1)
+ file (random.lower_cased 1)]
(all _.and
(_.for [/.mock]
($/.spec (io.io (/.mock /))))
diff --git a/stdlib/source/test/lux/world/net.lux b/stdlib/source/test/lux/world/net.lux
index e7780f688..9856b8a00 100644
--- a/stdlib/source/test/lux/world/net.lux
+++ b/stdlib/source/test/lux/world/net.lux
@@ -10,6 +10,7 @@
[\\library
["[0]" /]]
["[0]" /
+ ["[1][0]" mime]
["[1][0]" http
["[1]/[0]" client]
["[1]/[0]" cookie]
@@ -36,6 +37,8 @@
(_.coverage [/.Address]
true)
+ /mime.test
+
/http/client.test
/http/cookie.test
/http/header.test
diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux
index ce0a35e93..ed3eb915c 100644
--- a/stdlib/source/test/lux/world/net/http/client.lux
+++ b/stdlib/source/test/lux/world/net/http/client.lux
@@ -69,7 +69,7 @@
on_options random.nat
on_trace random.nat
num_headers (at ! each (nat.% 10) random.nat)
- headers (random.dictionary text.hash num_headers (random.lower_case 3) (random.lower_case 3))
+ headers (random.dictionary text.hash num_headers (random.lower_cased 3) (random.lower_cased 3))
.let [mock (is (/.Client IO)
(implementation
(def (request method url headers data)
diff --git a/stdlib/source/test/lux/world/net/http/cookie.lux b/stdlib/source/test/lux/world/net/http/cookie.lux
index 8ce0ef756..057da292b 100644
--- a/stdlib/source/test/lux/world/net/http/cookie.lux
+++ b/stdlib/source/test/lux/world/net/http/cookie.lux
@@ -34,9 +34,9 @@
Test
(<| (_.covering /._)
(do [! random.monad]
- [name (random.upper_case 1)
- fake_name (random.upper_case 2)
- expected (random.lower_case 1)
+ [name (random.upper_cased 1)
+ fake_name (random.upper_cased 2)
+ expected (random.lower_cased 1)
.let [cookie (is (/.Cookie Text)
[/.#name name
/.#in (|>>)
@@ -48,12 +48,12 @@
duration random.duration
instant random.instant
- domain (random.lower_case 2)
- path (random.lower_case 3)])
+ domain (random.lower_cased 2)
+ path (random.lower_cased 3)])
(_.for [/.Cookie /.#name /.#in /.#out])
(all _.and
(_.for [/.equivalence]
- (equivalenceS.spec /.equivalence (..random (list [cookie (random.lower_case 1)]))))
+ (equivalenceS.spec /.equivalence (..random (list [cookie (random.lower_cased 1)]))))
(_.for [/.Jar]
(all _.and
(_.coverage [/.empty]
diff --git a/stdlib/source/test/lux/world/net/http/header.lux b/stdlib/source/test/lux/world/net/http/header.lux
index 50b25f24b..7302fd653 100644
--- a/stdlib/source/test/lux/world/net/http/header.lux
+++ b/stdlib/source/test/lux/world/net/http/header.lux
@@ -18,8 +18,9 @@
[\\library
["[0]" / (.only)
[//
- ["[0]" mime (.use "[1]#[0]" equivalence)]
- ["[0]" cookie (.only Cookie)]]]])
+ ["[0]" cookie (.only Cookie)]
+ [//
+ ["[0]" mime (.use "[1]#[0]" equivalence)]]]]])
(def .public test
Test
@@ -30,8 +31,8 @@
(random#in mime.jpeg))
expected_location (random.either (random#in "http://example.com/yolo")
(random#in "http://example.com/meme"))
- header_name (random.lower_case 1)
- expected_header_value (random.upper_case 1)
+ header_name (random.lower_cased 1)
+ expected_header_value (random.upper_cased 1)
.let [header (is (/.Header Text)
[/.#name header_name
/.#in (|>>)
@@ -72,8 +73,8 @@
(try#each (text#= expected_location))
(try.else false)))
(do !
- [name (random.upper_case 1)
- expected_value (random.lower_case 1)
+ [name (random.upper_cased 1)
+ expected_value (random.lower_cased 1)
.let [cookie (is (Cookie Text)
[cookie.#name name
cookie.#in (|>>)
diff --git a/stdlib/source/test/lux/world/net/mime.lux b/stdlib/source/test/lux/world/net/mime.lux
new file mode 100644
index 000000000..8c5c84033
--- /dev/null
+++ b/stdlib/source/test/lux/world/net/mime.lux
@@ -0,0 +1,134 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]
+ [\\specification
+ ["[0]S" equivalence]
+ ["[0]S" hash]]]
+ [data
+ ["[0]" text (.only)
+ ["[0]" encoding (.only)
+ ["[1]T" \\test]]]
+ [collection
+ ["[0]" list]
+ ["[0]" set]]]
+ [math
+ ["[0]" random (.only Random) (.use "[1]#[0]" monad)]
+ [number
+ ["n" nat]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]])
+
+(with_expansions [<options> (these [/.aac]
+ [/.abiword]
+ [/.avi]
+ [/.amazon_kindle_ebook]
+ [/.binary]
+ [/.bitmap]
+ [/.bzip]
+ [/.bzip2]
+ [/.c_shell]
+ [/.css]
+ [/.csv]
+ [/.microsoft_word]
+ [/.microsoft_word_openxml]
+ [/.ms_embedded_opentype_fonts]
+ [/.epub]
+ [/.ecmascript]
+ [/.gif]
+ [/.html]
+ [/.icon]
+ [/.icalendar]
+ [/.jar]
+ [/.jpeg]
+ [/.javascript]
+ [/.json]
+ [/.midi]
+ [/.mpeg]
+ [/.apple_installer_package]
+ [/.opendocument_presentation]
+ [/.opendocument_spreadsheet]
+ [/.opendocument_text]
+ [/.ogg_audio]
+ [/.ogg_video]
+ [/.ogg]
+ [/.opentype_font]
+ [/.png]
+ [/.pdf]
+ [/.microsoft_powerpoint]
+ [/.microsoft_powerpoint_openxml]
+ [/.rar]
+ [/.rtf]
+ [/.bourne_shell]
+ [/.svg]
+ [/.flash]
+ [/.tar]
+ [/.tiff]
+ [/.typescript]
+ [/.truetype_font]
+ [/.microsoft_visio]
+ [/.wav]
+ [/.webm_audio]
+ [/.webm_video]
+ [/.webp]
+ [/.woff]
+ [/.woff2]
+ [/.xhtml]
+ [/.microsoft_excel]
+ [/.microsoft_excel_openxml]
+ [/.xml]
+ [/.xul]
+ [/.zip]
+
+ [/.audio_3gpp]
+ [/.video_3gpp]
+ [/.audio_3gpp2]
+ [/.video_3gpp2]
+ [/.compressed_7z]
+
+ [/.utf_8])
+ <types> (with_template [<type>]
+ [<type>]
+
+ <options>)]
+ (def .public random
+ (Random /.MIME)
+ (`` (all random.either
+ (,, (with_template [<type>]
+ [(random#in <type>)]
+
+ <options>))
+ )))
+
+ (def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [expected ..random
+ encoding encodingT.random])
+ (_.for [/.MIME])
+ (all _.and
+ (_.for [/.equivalence]
+ (equivalenceS.spec /.equivalence ..random))
+ (_.for [/.hash]
+ (hashS.spec /.hash ..random))
+
+ (_.coverage [/.mime /.name]
+ (|> expected
+ /.name
+ /.mime
+ (at /.equivalence = expected)))
+ (_.coverage [<types>]
+ (let [options (list <types>)
+ uniques (set.of_list /.hash options)]
+ (n.= (list.size options)
+ (set.size uniques))))
+ (_.coverage [/.text]
+ (|> (/.text encoding)
+ /.name
+ (text.contains? (encoding.name encoding))))
+ )))
+ )
diff --git a/stdlib/source/test/lux/world/net/uri/encoding.lux b/stdlib/source/test/lux/world/net/uri/encoding.lux
index f9a627e25..0bdb9a7a0 100644
--- a/stdlib/source/test/lux/world/net/uri/encoding.lux
+++ b/stdlib/source/test/lux/world/net/uri/encoding.lux
@@ -27,11 +27,11 @@
(let [choices (set.list /.reserved)
variety (list.size choices)])
(do [! random.monad]
- [safe (random.lower_case 1)
+ [safe (random.lower_cased 1)
- left (random.lower_case 1)
- middle (random.lower_case 1)
- right (random.lower_case 1)
+ left (random.lower_cased 1)
+ middle (random.lower_cased 1)
+ right (random.lower_cased 1)
left_choice (at ! each (n.% variety) random.nat)
right_choice (at ! each (n.% variety) random.nat)
.let [left_choice (maybe.trusted (list.item left_choice choices))
diff --git a/stdlib/source/test/lux/world/net/uri/path.lux b/stdlib/source/test/lux/world/net/uri/path.lux
index 1a6c15a53..968fd990c 100644
--- a/stdlib/source/test/lux/world/net/uri/path.lux
+++ b/stdlib/source/test/lux/world/net/uri/path.lux
@@ -21,7 +21,7 @@
(<| (_.covering /._)
(do [! random.monad]
[segments (at ! each (n.% 10) random.nat)
- segments (random.list segments (random.lower_case 1))])
+ segments (random.list segments (random.lower_cased 1))])
(_.for [/.Path])
(all _.and
(_.coverage [/.path /.Segment /.separator]
diff --git a/stdlib/source/test/lux/world/time/day.lux b/stdlib/source/test/lux/world/time/day.lux
index a893a1405..6f1ea4b3d 100644
--- a/stdlib/source/test/lux/world/time/day.lux
+++ b/stdlib/source/test/lux/world/time/day.lux
@@ -72,7 +72,7 @@
[/.#Friday /.#Saturday /.#Sunday]
))
(do random.monad
- [not_a_day (random.upper_case 1)]
+ [not_a_day (random.upper_cased 1)]
(_.coverage [/.not_a_day_of_the_week]
(when (at /.codec decoded not_a_day)
{try.#Failure error}
diff --git a/stdlib/source/test/lux/world/time/month.lux b/stdlib/source/test/lux/world/time/month.lux
index d259985c6..620af8077 100644
--- a/stdlib/source/test/lux/world/time/month.lux
+++ b/stdlib/source/test/lux/world/time/month.lux
@@ -109,7 +109,7 @@
(list#mix n.+ 0)
(n.= expected))))
(do random.monad
- [not_a_month (random.upper_case 1)]
+ [not_a_month (random.upper_cased 1)]
(_.coverage [/.not_a_month_of_the_year]
(when (at /.codec decoded not_a_month)
{try.#Failure error}