aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world
diff options
context:
space:
mode:
authorEduardo Julian2021-07-27 03:51:10 -0400
committerEduardo Julian2021-07-27 03:51:10 -0400
commit061fd8a209bbcaffc2bfb850ac6046752a567d50 (patch)
tree8cd83ad7d0bc06ded7976eb5420467e485733ae8 /stdlib/source/test/lux/world
parente64b6d0114c26a455e19a416b5f02a4d19dd711f (diff)
Re-named wrap => in && unwrap => out.
Diffstat (limited to 'stdlib/source/test/lux/world')
-rw-r--r--stdlib/source/test/lux/world/console.lux22
-rw-r--r--stdlib/source/test/lux/world/file/watch.lux146
-rw-r--r--stdlib/source/test/lux/world/input/keyboard.lux2
-rw-r--r--stdlib/source/test/lux/world/net/http/client.lux2
-rw-r--r--stdlib/source/test/lux/world/output/video/resolution.lux2
-rw-r--r--stdlib/source/test/lux/world/program.lux18
-rw-r--r--stdlib/source/test/lux/world/shell.lux64
7 files changed, 128 insertions, 128 deletions
diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux
index e7fd9f42b..c007b3ea8 100644
--- a/stdlib/source/test/lux/world/console.lux
+++ b/stdlib/source/test/lux/world/console.lux
@@ -28,24 +28,24 @@
[char (try.of_maybe (text.nth 0 content))
[_ content] (try.of_maybe (text.split 1 content))]
(if dead?
- (exception.throw ..dead [])
- (wrap [[dead? content] char]))))
+ (exception.except ..dead [])
+ (in [[dead? content] char]))))
(def: (on_read_line [dead? content])
(do try.monad
[[line content] (try.of_maybe (text.split_with text.new_line content))]
(if dead?
- (exception.throw ..dead [])
- (wrap [[dead? content] line]))))
+ (exception.except ..dead [])
+ (in [[dead? content] line]))))
(def: (on_write message [dead? content])
(if dead?
- (exception.throw ..dead [])
+ (exception.except ..dead [])
(#try.Success [dead? (format content message)])))
(def: (on_close [dead? content])
(if dead?
- (exception.throw ..dead [])
+ (exception.except ..dead [])
(#try.Success [true content])))))
(def: #export test
@@ -62,9 +62,9 @@
(do io.monad
[?_ (/.write_line expected console)
?actual (\ console read_line [])]
- (wrap (<| (try.default false)
- (do try.monad
- [_ ?_
- actual ?actual]
- (wrap (text\= expected actual)))))))))
+ (in (<| (try.default false)
+ (do try.monad
+ [_ ?_
+ actual ?actual]
+ (in (text\= expected actual)))))))))
)))
diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux
index cb24e89b7..7d09023cf 100644
--- a/stdlib/source/test/lux/world/file/watch.lux
+++ b/stdlib/source/test/lux/world/file/watch.lux
@@ -28,9 +28,9 @@
(def: concern
(Random [/.Concern (Predicate /.Concern)])
($_ random.either
- (random\wrap [/.creation /.creation?])
- (random\wrap [/.modification /.modification?])
- (random\wrap [/.deletion /.deletion?])
+ (random\in [/.creation /.creation?])
+ (random\in [/.modification /.modification?])
+ (random\in [/.deletion /.deletion?])
))
(def: concern\\test
@@ -71,22 +71,22 @@
[directory (random.ascii/alpha 5)
#let [[fs watcher] (/.mock "/")]]
($_ _.and
- (wrap (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)))))
+ (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)
@@ -104,16 +104,16 @@
(//.make_file async.monad fs (binary.create 0) expected_path))
poll/pre (\ watcher poll [])
poll/post (\ watcher poll [])]
- (wrap (and (case poll/pre
- (^ (list [concern actual_path]))
- (and (text\= expected_path actual_path)
- (and (/.creation? concern)
- (not (/.modification? concern))
- (not (/.deletion? concern))))
+ (in (and (case poll/pre
+ (^ (list [concern actual_path]))
+ (and (text\= expected_path actual_path)
+ (and (/.creation? concern)
+ (not (/.modification? concern))
+ (not (/.deletion? concern))))
- _
- false)
- (list.empty? poll/post)))))
+ _
+ false)
+ (list.empty? poll/post)))))
(def: (after_modification! fs watcher data expected_path)
(-> (//.System Async) (/.Watcher Async) Binary //.Path (Async (Try Bit)))
@@ -122,16 +122,16 @@
_ (\ fs write data expected_path)
poll/2 (\ watcher poll [])
poll/2' (\ watcher poll [])]
- (wrap (and (case poll/2
- (^ (list [concern actual_path]))
- (and (text\= expected_path actual_path)
- (and (not (/.creation? concern))
- (/.modification? concern)
- (not (/.deletion? concern))))
+ (in (and (case poll/2
+ (^ (list [concern actual_path]))
+ (and (text\= expected_path actual_path)
+ (and (not (/.creation? concern))
+ (/.modification? concern)
+ (not (/.deletion? concern))))
- _
- false)
- (list.empty? poll/2')))))
+ _
+ false)
+ (list.empty? poll/2')))))
(def: (after_deletion! fs watcher expected_path)
(-> (//.System Async) (/.Watcher Async) //.Path (Async (Try Bit)))
@@ -139,15 +139,15 @@
[_ (\ fs delete expected_path)
poll/3 (\ watcher poll [])
poll/3' (\ watcher poll [])]
- (wrap (and (case poll/3
- (^ (list [concern actual_path]))
- (and (not (/.creation? concern))
- (not (/.modification? concern))
- (/.deletion? concern))
+ (in (and (case poll/3
+ (^ (list [concern actual_path]))
+ (and (not (/.creation? concern))
+ (not (/.modification? concern))
+ (/.deletion? concern))
- _
- false)
- (list.empty? poll/3')))))
+ _
+ false)
+ (list.empty? poll/3')))))
(def: #export test
Test
@@ -164,36 +164,36 @@
expected_path (\ ! map (|>> (format directory /))
(random.ascii/alpha 5))
data ($binary.random 10)]
- (wrap (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)]
- (wrap (and no_events_prior_to_creation!
- after_creation!
- after_modification!
- after_deletion!)))]
- (_.cover' [/.mock /.polling]
- (try.default false verdict)))))
+ (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.default false verdict)))))
(do random.monad
[directory (random.ascii/alpha 5)
#let [/ "/"
[fs watcher] (/.mock /)]]
- (wrap (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))))))
+ (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 89c559bb5..24b657f0d 100644
--- a/stdlib/source/test/lux/world/input/keyboard.lux
+++ b/stdlib/source/test/lux/world/input/keyboard.lux
@@ -140,7 +140,7 @@
(let [count (list.size ..listing)]
(do {! random.monad}
[choice (\ ! map (n.% count) random.nat)]
- (wrap (maybe.assume (list.nth choice ..listing))))))
+ (in (maybe.assume (list.nth choice ..listing))))))
(def: #export test
Test
diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux
index c784d9cbe..1979003f0 100644
--- a/stdlib/source/test/lux/world/net/http/client.lux
+++ b/stdlib/source/test/lux/world/net/http/client.lux
@@ -73,7 +73,7 @@
[product.right (get@ #//.body) (function.apply #.None) io.run]
[product.right (\ utf8.codec decode)]
[(\ nat.decimal decode)]
- [(nat.= <expected>) wrap])
+ [(nat.= <expected>) in])
(try.default false)))]
[/.post on_post]
diff --git a/stdlib/source/test/lux/world/output/video/resolution.lux b/stdlib/source/test/lux/world/output/video/resolution.lux
index 851214fb8..411ae288d 100644
--- a/stdlib/source/test/lux/world/output/video/resolution.lux
+++ b/stdlib/source/test/lux/world/output/video/resolution.lux
@@ -47,7 +47,7 @@
(let [count (list.size ..listing)]
(do {! random.monad}
[choice (\ ! map (n.% count) random.nat)]
- (wrap (maybe.assume (list.nth choice ..listing))))))
+ (in (maybe.assume (list.nth choice ..listing))))))
(def: #export test
Test
diff --git a/stdlib/source/test/lux/world/program.lux b/stdlib/source/test/lux/world/program.lux
index 0028cfe9c..6760865e7 100644
--- a/stdlib/source/test/lux/world/program.lux
+++ b/stdlib/source/test/lux/world/program.lux
@@ -56,15 +56,15 @@
(io.run
(do io.monad
[actual (/.environment io.monad program)]
- (wrap (and (n.= (dictionary.size environment)
- (dictionary.size actual))
- (|> actual
- dictionary.entries
- (list.every? (function (_ [key value])
- (|> environment
- (dictionary.get key)
- (maybe\map (text\= value))
- (maybe.default false)))))))))))
+ (in (and (n.= (dictionary.size environment)
+ (dictionary.size actual))
+ (|> actual
+ dictionary.entries
+ (list.every? (function (_ [key value])
+ (|> environment
+ (dictionary.get key)
+ (maybe\map (text\= value))
+ (maybe.default false)))))))))))
(_.cover [/.unknown_environment_variable]
(let [program (/.mock environment home directory)]
(|> unknown
diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux
index 1cd1473e8..4008c4c5a 100644
--- a/stdlib/source/test/lux/world/shell.lux
+++ b/stdlib/source/test/lux/world/shell.lux
@@ -36,29 +36,29 @@
(implementation
(def: (on_read dead?)
(if dead?
- (exception.throw ..dead [])
+ (exception.except ..dead [])
(do try.monad
[to_echo (try.of_maybe (list.head arguments))]
- (wrap [dead? to_echo]))))
+ (in [dead? to_echo]))))
(def: (on_error dead?)
(if dead?
- (exception.throw ..dead [])
+ (exception.except ..dead [])
(exception.return [dead? ""])))
(def: (on_write message dead?)
(if dead?
- (exception.throw ..dead [])
+ (exception.except ..dead [])
(#try.Success dead?)))
(def: (on_destroy dead?)
(if dead?
- (exception.throw ..dead [])
+ (exception.except ..dead [])
(#try.Success true)))
(def: (on_await dead?)
(if dead?
- (exception.throw ..dead [])
+ (exception.except ..dead [])
(#try.Success [true /.normal])))))
(def: (io_shell command oops input destruction exit)
@@ -96,33 +96,33 @@
destruction (random.ascii/alpha 5)
exit random.int
#let [shell (/.async (..io_shell command oops input destruction exit))]]
- (wrap (do {! async.monad}
- [verdict (do (try.with !)
- [process (\ shell execute [environment.empty "~" command (list)])
- read (\ process read [])
- error (\ process error [])
- wrote! (do !
- [write (\ process write input)]
- (wrap (#try.Success (case write
+ (in (do {! async.monad}
+ [verdict (do (try.with !)
+ [process (\ shell execute [environment.empty "~" command (list)])
+ read (\ process read [])
+ error (\ process error [])
+ 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 write)
- (text\= input write)))))
- destroyed! (do !
- [destroy (\ process destroy [])]
- (wrap (#try.Success (case destroy
- (#try.Success _)
- false
-
- (#try.Failure destroy)
- (text\= destruction destroy)))))
- await (\ process await [])]
- (wrap (and (text\= command read)
- (text\= oops error)
- wrote!
- destroyed!
- (i.= exit await))))]
- (_.cover' [/.Shell]
- (try.default false verdict)))))
+ (#try.Failure destroy)
+ (text\= destruction destroy)))))
+ await (\ process await [])]
+ (in (and (text\= command read)
+ (text\= oops error)
+ wrote!
+ destroyed!
+ (i.= exit await))))]
+ (_.cover' [/.Shell]
+ (try.default false verdict)))))
)))