aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world
diff options
context:
space:
mode:
authorEduardo Julian2022-04-08 05:42:36 -0400
committerEduardo Julian2022-04-08 05:42:36 -0400
commit0d909187d5b9effcd08f533d50af7d29c0d6bfd8 (patch)
treec50f12c5e47e3db90c3a701b54ee9953da942210 /stdlib/source/test/lux/world
parente5e4c2aff562e5c01fefb808d1d68a40f29c9cc5 (diff)
De-sigil-ification: $
Diffstat (limited to 'stdlib/source/test/lux/world')
-rw-r--r--stdlib/source/test/lux/world/console.lux70
-rw-r--r--stdlib/source/test/lux/world/file.lux74
-rw-r--r--stdlib/source/test/lux/world/file/watch.lux192
-rw-r--r--stdlib/source/test/lux/world/input/keyboard.lux38
-rw-r--r--stdlib/source/test/lux/world/net/http/client.lux50
-rw-r--r--stdlib/source/test/lux/world/net/http/status.lux14
-rw-r--r--stdlib/source/test/lux/world/output/video/resolution.lux18
-rw-r--r--stdlib/source/test/lux/world/program.lux56
-rw-r--r--stdlib/source/test/lux/world/shell.lux86
9 files changed, 299 insertions, 299 deletions
diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux
index e1452b0a3..06963e92d 100644
--- a/stdlib/source/test/lux/world/console.lux
+++ b/stdlib/source/test/lux/world/console.lux
@@ -1,22 +1,22 @@
(.using
- [library
- [lux "*"
- ["_" test {"+" Test}]
- [abstract
- [monad {"+" do}]]
- [control
- ["[0]" io]
- ["[0]" try {"+" Try}]
- ["[0]" exception {"+" exception:}]]
- [data
- ["[0]" text ("[1]#[0]" equivalence)
- ["%" format {"+" format}]]]
- [math
- ["[0]" random]]]]
- [\\library
- ["[0]" /]]
- [\\specification
- ["$[0]" /]])
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]]
+ [control
+ ["[0]" io]
+ ["[0]" try {"+" Try}]
+ ["[0]" exception {"+" exception:}]]
+ [data
+ ["[0]" text ("[1]#[0]" equivalence)
+ ["%" format {"+" format}]]]
+ [math
+ ["[0]" random]]]]
+ [\\library
+ ["[0]" /]]
+ [\\specification
+ ["$[0]" /]])
(exception: dead)
@@ -51,20 +51,20 @@
(def: .public test
Test
(<| (_.covering /._)
- ($_ _.and
- (_.for [/.async /.mock /.Mock]
- ($/.spec (io.io (/.async (/.mock ..mock [false ""])))))
- (do random.monad
- [expected (random.ascii/alpha 10)
- .let [console (/.mock ..mock [false ""])]]
- (_.cover [/.write_line]
- (io.run!
- (do io.monad
- [?_ (/.write_line expected console)
- ?actual (# console read_line [])]
- (in (<| (try.else false)
- (do try.monad
- [_ ?_
- actual ?actual]
- (in (text#= expected actual)))))))))
- )))
+ (all _.and
+ (_.for [/.async /.mock /.Mock]
+ ($/.spec (io.io (/.async (/.mock ..mock [false ""])))))
+ (do random.monad
+ [expected (random.ascii/alpha 10)
+ .let [console (/.mock ..mock [false ""])]]
+ (_.cover [/.write_line]
+ (io.run!
+ (do io.monad
+ [?_ (/.write_line expected console)
+ ?actual (# console read_line [])]
+ (in (<| (try.else false)
+ (do try.monad
+ [_ ?_
+ actual ?actual]
+ (in (text#= expected actual)))))))))
+ )))
diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux
index 5d1654269..b5d9892ad 100644
--- a/stdlib/source/test/lux/world/file.lux
+++ b/stdlib/source/test/lux/world/file.lux
@@ -244,44 +244,44 @@
(do [! random.monad]
[/ (random.ascii/upper 1)
file (random.ascii/lower 1)]
- ($_ _.and
- (_.for [/.mock]
- ($/.spec (io.io (/.mock /))))
- (_.for [/.async]
- ($/.spec (io.io (/.async (..fs /)))))
+ (all _.and
+ (_.for [/.mock]
+ ($/.spec (io.io (/.mock /))))
+ (_.for [/.async]
+ ($/.spec (io.io (/.async (..fs /)))))
- (in (do async.monad
- [.let [fs (/.mock /)]
- ? (# fs delete file)]
- (_.cover' [/.cannot_delete]
- (case ?
- {try.#Failure error}
- (exception.match? /.cannot_delete error)
+ (in (do async.monad
+ [.let [fs (/.mock /)]
+ ? (# fs delete file)]
+ (_.cover' [/.cannot_delete]
+ (case ?
+ {try.#Failure error}
+ (exception.match? /.cannot_delete error)
- _
- false))))
- (in (do async.monad
- [.let [fs (/.mock /)]
- ? (# fs read file)]
- (_.cover' [/.cannot_find_file]
- (case ?
- {try.#Failure error}
- (exception.match? /.cannot_find_file error)
+ _
+ false))))
+ (in (do async.monad
+ [.let [fs (/.mock /)]
+ ? (# fs read file)]
+ (_.cover' [/.cannot_find_file]
+ (case ?
+ {try.#Failure error}
+ (exception.match? /.cannot_find_file error)
- _
- false))))
- (in (do async.monad
- [.let [fs (/.mock /)]
- ?/0 (# fs directory_files file)
- ?/1 (# fs sub_directories file)]
- (_.cover' [/.cannot_find_directory]
- (case [?/0 ?/1]
- [{try.#Failure error/0} {try.#Failure error/1}]
- (and (exception.match? /.cannot_find_directory error/0)
- (exception.match? /.cannot_find_directory error/1))
+ _
+ false))))
+ (in (do async.monad
+ [.let [fs (/.mock /)]
+ ?/0 (# fs directory_files file)
+ ?/1 (# fs sub_directories file)]
+ (_.cover' [/.cannot_find_directory]
+ (case [?/0 ?/1]
+ [{try.#Failure error/0} {try.#Failure error/1}]
+ (and (exception.match? /.cannot_find_directory error/0)
+ (exception.match? /.cannot_find_directory error/1))
- _
- false))))
-
- /watch.test
- ))))
+ _
+ false))))
+
+ /watch.test
+ ))))
diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux
index a8bcda085..6389dec6f 100644
--- a/stdlib/source/test/lux/world/file/watch.lux
+++ b/stdlib/source/test/lux/world/file/watch.lux
@@ -27,66 +27,66 @@
(def: concern
(Random [/.Concern (Predicate /.Concern)])
- ($_ random.either
- (random#in [/.creation /.creation?])
- (random#in [/.modification /.modification?])
- (random#in [/.deletion /.deletion?])
- ))
+ (all random.either
+ (random#in [/.creation /.creation?])
+ (random#in [/.modification /.modification?])
+ (random#in [/.deletion /.deletion?])
+ ))
(def: concern##test
Test
- ($_ _.and
- (_.cover [/.creation /.creation?]
- (and (/.creation? /.creation)
- (not (/.creation? /.modification))
- (not (/.creation? /.deletion))))
- (_.cover [/.modification /.modification?]
- (and (not (/.modification? /.creation))
- (/.modification? /.modification)
- (not (/.modification? /.deletion))))
- (_.cover [/.deletion /.deletion?]
- (and (not (/.deletion? /.creation))
- (not (/.deletion? /.modification))
- (/.deletion? /.deletion)))
- (do random.monad
- [left ..concern
- right (random.only (|>> (same? left) not)
- ..concern)
- .let [[left left?] left
- [right right?] right]]
- (_.cover [/.also]
- (let [composition (/.also left right)]
- (and (left? composition)
- (right? composition)))))
- (_.cover [/.all]
- (and (/.creation? /.all)
- (/.modification? /.all)
- (/.deletion? /.all)))
- ))
+ (all _.and
+ (_.cover [/.creation /.creation?]
+ (and (/.creation? /.creation)
+ (not (/.creation? /.modification))
+ (not (/.creation? /.deletion))))
+ (_.cover [/.modification /.modification?]
+ (and (not (/.modification? /.creation))
+ (/.modification? /.modification)
+ (not (/.modification? /.deletion))))
+ (_.cover [/.deletion /.deletion?]
+ (and (not (/.deletion? /.creation))
+ (not (/.deletion? /.modification))
+ (/.deletion? /.deletion)))
+ (do random.monad
+ [left ..concern
+ right (random.only (|>> (same? left) not)
+ ..concern)
+ .let [[left left?] left
+ [right right?] right]]
+ (_.cover [/.also]
+ (let [composition (/.also left right)]
+ (and (left? composition)
+ (right? composition)))))
+ (_.cover [/.all]
+ (and (/.creation? /.all)
+ (/.modification? /.all)
+ (/.deletion? /.all)))
+ ))
(def: exception
Test
(do [! random.monad]
[directory (random.ascii/alpha 5)
.let [[fs watcher] (/.mock "/")]]
- ($_ _.and
- (in (do async.monad
- [?concern (# watcher concern directory)
- ?stop (# watcher stop directory)]
- (_.cover' [/.not_being_watched]
- (and (case ?concern
- {try.#Failure error}
- (exception.match? /.not_being_watched error)
-
- {try.#Success _}
- false)
- (case ?stop
- {try.#Failure error}
- (exception.match? /.not_being_watched error)
-
- {try.#Success _}
- false)))))
- )))
+ (all _.and
+ (in (do async.monad
+ [?concern (# watcher concern directory)
+ ?stop (# watcher stop directory)]
+ (_.cover' [/.not_being_watched]
+ (and (case ?concern
+ {try.#Failure error}
+ (exception.match? /.not_being_watched error)
+
+ {try.#Success _}
+ false)
+ (case ?stop
+ {try.#Failure error}
+ (exception.match? /.not_being_watched error)
+
+ {try.#Success _}
+ false)))))
+ )))
(def: (no_events_prior_to_creation! fs watcher directory)
(-> (//.System Async) (/.Watcher Async) //.Path (Async (Try Bit)))
@@ -152,48 +152,48 @@
Test
(<| (_.covering /._)
(_.for [/.Watcher])
- ($_ _.and
- (_.for [/.Concern]
- ..concern##test)
- ..exception
-
- (do [! random.monad]
- [directory (random.ascii/alpha 5)
- .let [/ "/"
- [fs watcher] (/.mock /)]
- expected_path (# ! each (|>> (format directory /))
- (random.ascii/alpha 5))
- data ($binary.random 10)]
- (in (do [! async.monad]
- [verdict (do (try.with !)
- [no_events_prior_to_creation!
- (..no_events_prior_to_creation! fs watcher directory)
-
- after_creation!
- (..after_creation! fs watcher expected_path)
-
- after_modification!
- (..after_modification! fs watcher data expected_path)
-
- after_deletion!
- (..after_deletion! fs watcher expected_path)]
- (in (and no_events_prior_to_creation!
- after_creation!
- after_modification!
- after_deletion!)))]
- (_.cover' [/.mock /.polling]
- (try.else false verdict)))))
- (do random.monad
- [directory (random.ascii/alpha 5)
- .let [/ "/"
- [fs watcher] (/.mock /)]]
- (in (do async.monad
- [started? (# watcher start /.all directory)]
- (_.cover' [/.cannot_poll_a_non_existent_directory]
- (case started?
- {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.cannot_poll_a_non_existent_directory error))))))
- )))
+ (all _.and
+ (_.for [/.Concern]
+ ..concern##test)
+ ..exception
+
+ (do [! random.monad]
+ [directory (random.ascii/alpha 5)
+ .let [/ "/"
+ [fs watcher] (/.mock /)]
+ expected_path (# ! each (|>> (format directory /))
+ (random.ascii/alpha 5))
+ data ($binary.random 10)]
+ (in (do [! async.monad]
+ [verdict (do (try.with !)
+ [no_events_prior_to_creation!
+ (..no_events_prior_to_creation! fs watcher directory)
+
+ after_creation!
+ (..after_creation! fs watcher expected_path)
+
+ after_modification!
+ (..after_modification! fs watcher data expected_path)
+
+ after_deletion!
+ (..after_deletion! fs watcher expected_path)]
+ (in (and no_events_prior_to_creation!
+ after_creation!
+ after_modification!
+ after_deletion!)))]
+ (_.cover' [/.mock /.polling]
+ (try.else false verdict)))))
+ (do random.monad
+ [directory (random.ascii/alpha 5)
+ .let [/ "/"
+ [fs watcher] (/.mock /)]]
+ (in (do async.monad
+ [started? (# watcher start /.all directory)]
+ (_.cover' [/.cannot_poll_a_non_existent_directory]
+ (case started?
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.cannot_poll_a_non_existent_directory error))))))
+ )))
diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux
index 5553373d7..0e509448c 100644
--- a/stdlib/source/test/lux/world/input/keyboard.lux
+++ b/stdlib/source/test/lux/world/input/keyboard.lux
@@ -147,24 +147,24 @@
Test
(<| (_.covering /._)
(_.for [/.Key])
- (`` ($_ _.and
- (~~ (template [<definition> <keys>]
- [<definition>]
-
- <groups>))
+ (`` (all _.and
+ (~~ (template [<definition> <keys>]
+ [<definition>]
+
+ <groups>))
- (_.for [/.Press]
- (`` ($_ _.and
- (~~ (template [<pressed?> <function>]
- [(do random.monad
- [key ..random
- .let [sample (<function> key)]]
- (_.cover [<function>]
- (and (bit#= <pressed?> (the /.#pressed? sample))
- (n.= key (the /.#input sample)))))]
+ (_.for [/.Press]
+ (`` (all _.and
+ (~~ (template [<pressed?> <function>]
+ [(do random.monad
+ [key ..random
+ .let [sample (<function> key)]]
+ (_.cover [<function>]
+ (and (bit#= <pressed?> (the /.#pressed? sample))
+ (n.= key (the /.#input sample)))))]
- [#0 /.release]
- [#1 /.press]
- ))
- )))
- )))))
+ [#0 /.release]
+ [#1 /.press]
+ ))
+ )))
+ )))))
diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux
index aee92d1a0..c84bc1502 100644
--- a/stdlib/source/test/lux/world/net/http/client.lux
+++ b/stdlib/source/test/lux/world/net/http/client.lux
@@ -97,31 +97,31 @@
[/.connect on_connect]
[/.options on_options]
[/.trace on_trace])]
- (`` ($_ _.and
- (~~ (template [<definition> <expected>]
- [(_.cover [<definition>]
- (|> (<definition> "" //.empty {.#None} mock)
- (verification io.monad <expected>)
- io.run!))]
+ (`` (all _.and
+ (~~ (template [<definition> <expected>]
+ [(_.cover [<definition>]
+ (|> (<definition> "" //.empty {.#None} mock)
+ (verification io.monad <expected>)
+ io.run!))]
- <cases>
- ))
- (_.cover [/.headers]
- (nat.= (dictionary.size headers)
- (|> headers
- dictionary.entries
- /.headers
- dictionary.size)))
- (in (do [! async.monad]
- [.let [mock (/.async mock)]
- (~~ (template [<definition> <expected>]
- [<expected> (|> (<definition> "" //.empty {.#None} mock)
- (verification ! <expected>))]
+ <cases>
+ ))
+ (_.cover [/.headers]
+ (nat.= (dictionary.size headers)
+ (|> headers
+ dictionary.entries
+ /.headers
+ dictionary.size)))
+ (in (do [! async.monad]
+ [.let [mock (/.async mock)]
+ (~~ (template [<definition> <expected>]
+ [<expected> (|> (<definition> "" //.empty {.#None} mock)
+ (verification ! <expected>))]
- <cases>))]
- (_.cover' [/.async]
- (and (~~ (template [<definition> <expected>]
- [<expected>]
+ <cases>))]
+ (_.cover' [/.async]
+ (and (~~ (template [<definition> <expected>]
+ [<expected>]
- <cases>))))))
- ))))))
+ <cases>))))))
+ ))))))
diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux
index b9018fda1..3dc8326ae 100644
--- a/stdlib/source/test/lux/world/net/http/status.lux
+++ b/stdlib/source/test/lux/world/net/http/status.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux "*"
+ [lux {"-" all}
["_" test {"+" Test}]
[data
[collection
@@ -111,10 +111,10 @@
(def: .public test
Test
(<| (_.covering /._)
- (`` ($_ _.and
- (~~ (template [<category> <status+>]
- [<category>]
-
- <categories>))
- ))))
+ (`` (.all _.and
+ (~~ (template [<category> <status+>]
+ [<category>]
+
+ <categories>))
+ ))))
)
diff --git a/stdlib/source/test/lux/world/output/video/resolution.lux b/stdlib/source/test/lux/world/output/video/resolution.lux
index 9b385af95..65713e748 100644
--- a/stdlib/source/test/lux/world/output/video/resolution.lux
+++ b/stdlib/source/test/lux/world/output/video/resolution.lux
@@ -54,13 +54,13 @@
Test
(<| (_.covering /._)
(_.for [/.Resolution])
- ($_ _.and
- (_.for [/.equivalence]
- ($equivalence.spec /.equivalence ..random))
- (_.for [/.hash]
- ($hash.spec /.hash ..random))
+ (all _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+ (_.for [/.hash]
+ ($hash.spec /.hash ..random))
- (_.cover [<resolutions>]
- (n.= (list.size ..listing)
- (set.size ..catalogue)))
- ))))
+ (_.cover [<resolutions>]
+ (n.= (list.size ..listing)
+ (set.size ..catalogue)))
+ ))))
diff --git a/stdlib/source/test/lux/world/program.lux b/stdlib/source/test/lux/world/program.lux
index d1696c608..2075fd410 100644
--- a/stdlib/source/test/lux/world/program.lux
+++ b/stdlib/source/test/lux/world/program.lux
@@ -48,31 +48,31 @@
directory ..path
unknown (random.ascii/alpha 1)]
- ($_ _.and
- (_.for [/.mock /.async]
- ($/.spec (/.async (/.mock environment home directory))))
- (_.cover [/.environment]
- (let [program (/.mock environment home directory)]
- (io.run!
- (do io.monad
- [actual (/.environment io.monad program)]
- (in (and (n.= (dictionary.size environment)
- (dictionary.size actual))
- (|> actual
- dictionary.entries
- (list.every? (function (_ [key value])
- (|> environment
- (dictionary.value key)
- (maybe#each (text#= value))
- (maybe.else false)))))))))))
- (_.cover [/.unknown_environment_variable]
- (let [program (/.mock environment home directory)]
- (|> unknown
- (# program variable)
- io.run!
- (pipe.case {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.unknown_environment_variable error)))))
- ))))
+ (all _.and
+ (_.for [/.mock /.async]
+ ($/.spec (/.async (/.mock environment home directory))))
+ (_.cover [/.environment]
+ (let [program (/.mock environment home directory)]
+ (io.run!
+ (do io.monad
+ [actual (/.environment io.monad program)]
+ (in (and (n.= (dictionary.size environment)
+ (dictionary.size actual))
+ (|> actual
+ dictionary.entries
+ (list.every? (function (_ [key value])
+ (|> environment
+ (dictionary.value key)
+ (maybe#each (text#= value))
+ (maybe.else false)))))))))))
+ (_.cover [/.unknown_environment_variable]
+ (let [program (/.mock environment home directory)]
+ (|> unknown
+ (# program variable)
+ io.run!
+ (pipe.case {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.unknown_environment_variable error)))))
+ ))))
diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux
index 608af1381..30d19d53c 100644
--- a/stdlib/source/test/lux/world/shell.lux
+++ b/stdlib/source/test/lux/world/shell.lux
@@ -83,46 +83,46 @@
(def: .public test
Test
(<| (_.covering /._)
- ($_ _.and
- (_.for [/.async /.mock /.Mock]
- ($/.spec (/.async (/.mock (|>> ..mock {try.#Success})
- false))))
- (_.cover [/.error]
- (not (i.= /.normal /.error)))
- (do random.monad
- [command (random.ascii/alpha 5)
- oops (random.ascii/alpha 5)
- input (random.ascii/alpha 5)
- destruction (random.ascii/alpha 5)
- exit random.int
- .let [shell (/.async (..io_shell command oops input destruction exit))]]
- (in (do [! async.monad]
- [verdict (do (try.with !)
- [process (# shell execute [environment.empty "~" command (list)])
- read (# process read [])
- failure (# process fail [])
- wrote! (do !
- [write (# process write input)]
- (in {try.#Success (case write
- {try.#Success _}
- false
-
- {try.#Failure write}
- (text#= input write))}))
- destroyed! (do !
- [destroy (# process destroy [])]
- (in {try.#Success (case destroy
- {try.#Success _}
- false
-
- {try.#Failure destroy}
- (text#= destruction destroy))}))
- await (# process await [])]
- (in (and (text#= command read)
- (text#= oops failure)
- wrote!
- destroyed!
- (i.= exit await))))]
- (_.cover' [/.Shell]
- (try.else false verdict)))))
- )))
+ (all _.and
+ (_.for [/.async /.mock /.Mock]
+ ($/.spec (/.async (/.mock (|>> ..mock {try.#Success})
+ false))))
+ (_.cover [/.error]
+ (not (i.= /.normal /.error)))
+ (do random.monad
+ [command (random.ascii/alpha 5)
+ oops (random.ascii/alpha 5)
+ input (random.ascii/alpha 5)
+ destruction (random.ascii/alpha 5)
+ exit random.int
+ .let [shell (/.async (..io_shell command oops input destruction exit))]]
+ (in (do [! async.monad]
+ [verdict (do (try.with !)
+ [process (# shell execute [environment.empty "~" command (list)])
+ read (# process read [])
+ failure (# process fail [])
+ wrote! (do !
+ [write (# process write input)]
+ (in {try.#Success (case write
+ {try.#Success _}
+ false
+
+ {try.#Failure write}
+ (text#= input write))}))
+ destroyed! (do !
+ [destroy (# process destroy [])]
+ (in {try.#Success (case destroy
+ {try.#Success _}
+ false
+
+ {try.#Failure destroy}
+ (text#= destruction destroy))}))
+ await (# process await [])]
+ (in (and (text#= command read)
+ (text#= oops failure)
+ wrote!
+ destroyed!
+ (i.= exit await))))]
+ (_.cover' [/.Shell]
+ (try.else false verdict)))))
+ )))