diff options
author | Eduardo Julian | 2022-10-22 12:43:39 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-10-22 12:43:39 -0400 |
commit | 8c63a525089597af1f9282c76daf97bf2b6058e0 (patch) | |
tree | 19750dcc3d0ad1bf14a1441a4f781c26b9285bd8 /stdlib/source/test/lux/world | |
parent | b25eec45fa9aabdc252d59afad3e0c7e73a18fd9 (diff) |
New (optional) names for Frac type + fixed module of CSP concurrency.
Diffstat (limited to 'stdlib/source/test/lux/world')
-rw-r--r-- | stdlib/source/test/lux/world/input/keyboard.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/net.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/net/http/client.lux | 5 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/net/http/header.lux | 73 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/net/http/status.lux | 1 |
5 files changed, 80 insertions, 3 deletions
diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index 408e3f92c..d04d4dba0 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -155,7 +155,7 @@ <groups>)) - (_.for [/.Press] + (_.for [/.Press /.#input /.#pressed?] (`` (all _.and (,, (with_template [<pressed?> <function>] [(do random.monad diff --git a/stdlib/source/test/lux/world/net.lux b/stdlib/source/test/lux/world/net.lux index f0c4acb39..252c6e077 100644 --- a/stdlib/source/test/lux/world/net.lux +++ b/stdlib/source/test/lux/world/net.lux @@ -12,6 +12,7 @@ ["[0]" / ["[1][0]" http ["[1]/[0]" client] + ["[1]/[0]" header] ["[1]/[0]" status] ["[1]/[0]" version]] ["[1][0]" uri @@ -33,6 +34,7 @@ true) /http/client.test + /http/header.test /http/status.test /http/version.test diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index aa8ed3b58..ce0a35e93 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -29,6 +29,7 @@ [\\library ["[0]" / (.only) ["/[1]" // (.only) + ["[0]" header] ["[1][0]" status]]]]) (def (verification ! expected response) @@ -102,7 +103,7 @@ (`` (all _.and (,, (with_template [<definition> <expected>] [(_.coverage [<definition>] - (|> (<definition> "" //.empty {.#None} mock) + (|> (<definition> "" header.empty {.#None} mock) (verification io.monad <expected>) io.run!))] @@ -117,7 +118,7 @@ (in (do [! async.monad] [.let [mock (/.async mock)] (,, (with_template [<definition> <expected>] - [<expected> (|> (<definition> "" //.empty {.#None} mock) + [<expected> (|> (<definition> "" header.empty {.#None} mock) (verification ! <expected>))] <cases>))] diff --git a/stdlib/source/test/lux/world/net/http/header.lux b/stdlib/source/test/lux/world/net/http/header.lux new file mode 100644 index 000000000..6a3c48a99 --- /dev/null +++ b/stdlib/source/test/lux/world/net/http/header.lux @@ -0,0 +1,73 @@ +(.require + [library + [lux (.except) + [abstract + [monad (.only do)]] + [control + ["|" pipe] + ["[0]" try (.use "[1]#[0]" functor)] + ["[0]" exception]] + [data + ["[0]" text (.use "[1]#[0]" equivalence)]] + [math + ["[0]" random (.only Random) (.use "[1]#[0]" monad)] + [number + ["[0]" nat (.use "[1]#[0]" equivalence)]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + [// + ["[0]" mime (.use "[1]#[0]" equivalence)]]]]) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [expected_content_length random.nat + expected_content_type (random.either (random#in mime.javascript) + (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) + .let [header (is (/.Header Text) + [/.#name header_name + /.#in (|>>) + /.#out (|>> {try.#Success})])]]) + (all _.and + (_.coverage [/.Headers /.empty /.unknown] + (|> /.empty + (/.one header) + (|.when + {try.#Success _} + false + + {try.#Failure error} + (exception.match? /.unknown error)))) + (_.coverage [/.Header /.#name /.#in /.#out + /.has /.one] + (|> /.empty + (/.has header expected_header_value) + (/.one header) + (try#each (same? expected_header_value)) + (try.else false))) + (_.coverage [/.content_length] + (|> /.empty + (/.has /.content_length expected_content_length) + (/.one /.content_length) + (try#each (nat#= expected_content_length)) + (try.else false))) + (_.coverage [/.content_type] + (|> /.empty + (/.has /.content_type expected_content_type) + (/.one /.content_type) + (try#each (mime#= expected_content_type)) + (try.else false))) + (_.coverage [/.location] + (|> /.empty + (/.has /.location expected_location) + (/.one /.location) + (try#each (text#= expected_location)) + (try.else false))) + ))) diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux index e155c44a0..f2522222a 100644 --- a/stdlib/source/test/lux/world/net/http/status.lux +++ b/stdlib/source/test/lux/world/net/http/status.lux @@ -113,6 +113,7 @@ (def .public test Test (<| (_.covering /._) + (_.for [/.Status]) (`` (.all _.and (,, (with_template [<category> <status+>] [<category>] |