aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/command
diff options
context:
space:
mode:
authorEduardo Julian2021-06-24 03:42:57 -0400
committerEduardo Julian2021-06-24 03:42:57 -0400
commitce1a7a131f7c4df8eae5c019eba2893b56f04d46 (patch)
tree645c4b42c4b9bff141b7390d9f33f3f1fe4aeea1 /stdlib/source/test/aedifex/command
parenta82bd1eabe94763162c2b0707d9c198fbe9835e3 (diff)
Added a macro for type-casting JVM objects.
Diffstat (limited to 'stdlib/source/test/aedifex/command')
-rw-r--r--stdlib/source/test/aedifex/command/auto.lux29
-rw-r--r--stdlib/source/test/aedifex/command/build.lux12
-rw-r--r--stdlib/source/test/aedifex/command/test.lux10
3 files changed, 29 insertions, 22 deletions
diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux
index 7bac6eb5d..c23519bcc 100644
--- a/stdlib/source/test/aedifex/command/auto.lux
+++ b/stdlib/source/test/aedifex/command/auto.lux
@@ -20,7 +20,7 @@
["." set]
["." list ("#\." functor)]]]
[math
- ["." random]
+ ["." random (#+ Random)]
[number
["n" nat]]]
[world
@@ -56,10 +56,10 @@
[@runs
(function (_ console program fs shell resolution profile)
(do {! promise.monad}
- [[runs remaining_files] (promise.future
- (atom.update (function (_ [runs remaining_files])
- [(inc runs) remaining_files])
- @runs))]
+ [[_ [runs remaining_files]] (promise.future
+ (atom.update (function (_ [runs remaining_files])
+ [(inc runs) remaining_files])
+ @runs))]
(case remaining_files
#.Nil
(wrap (#try.Failure end_signal))
@@ -78,15 +78,10 @@
[#let [/ (\ file.default separator)
[fs watcher] (watch.mock /)]
end_signal (random.ascii/alpha 5)
+
program (random.ascii/alpha 5)
target (random.ascii/alpha 5)
- home (random.ascii/alpha 5)
- working_directory (random.ascii/alpha 5)
- expected_runs (\ ! map (|>> (n.% 10) (n.max 2)) random.nat)
source (random.ascii/alpha 5)
- dummy_files (|> (random.ascii/alpha 5)
- (random.set text.hash (dec expected_runs))
- (\ ! map (|>> set.to_list (list\map (|>> (format source /))))))
#let [empty_profile (: Profile
(\ ///.monoid identity))
with_target (: (-> Profile Profile)
@@ -98,6 +93,14 @@
with_program
with_target
(set@ #///.sources (set.from_list text.hash (list source))))]
+
+ home (random.ascii/alpha 5)
+ working_directory (random.ascii/alpha 5)
+
+ expected_runs (\ ! map (|>> (n.% 10) (n.max 2)) random.nat)
+ dummy_files (|> (random.ascii/alpha 5)
+ (random.set text.hash (dec expected_runs))
+ (\ ! map (|>> set.to_list (list\map (|>> (format source /))))))
resolution @build.resolution]
($_ _.and
(wrap (do promise.monad
@@ -106,11 +109,11 @@
_ (!.use (\ fs create_directory) [source])
_ (\ watcher poll [])]
(do promise.monad
- [outcome ((/.do! watcher command)
+ [outcome ((/.do! 1 watcher command)
(@version.echo "")
(program.async (program.mock environment.empty home working_directory))
fs
- (@build.good_shell [])
+ (shell.async (@build.good_shell []))
resolution
profile)
[actual_runs _] (promise.future (atom.read @runs))]
diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux
index 85231ae33..234343fea 100644
--- a/stdlib/source/test/aedifex/command/build.lux
+++ b/stdlib/source/test/aedifex/command/build.lux
@@ -45,9 +45,9 @@
(: (shell.Simulation [])
(structure
(def: (on_read state)
- (#try.Failure "on_read"))
+ (exception.throw shell.no_more_output []))
(def: (on_error state)
- (#try.Failure "on_error"))
+ (exception.throw shell.no_more_output []))
(def: (on_write input state)
(#try.Failure "on_write"))
(def: (on_destroy state)
@@ -63,9 +63,9 @@
(: (shell.Simulation [])
(structure
(def: (on_read state)
- (#try.Failure "on_read"))
+ (exception.throw shell.no_more_output []))
(def: (on_error state)
- (#try.Failure "on_error"))
+ (exception.throw shell.no_more_output []))
(def: (on_write input state)
(#try.Failure "on_write"))
(def: (on_destroy state)
@@ -98,7 +98,9 @@
Test
(<| (_.covering /._)
(do {! random.monad}
- [#let [fs (file.mock (\ file.default separator))
+ [last_read (random.ascii/alpha 5)
+ last_error (random.ascii/alpha 5)
+ #let [fs (file.mock (\ file.default separator))
shell (shell.async (..good_shell []))]
program (random.ascii/alpha 5)
target (random.ascii/alpha 5)
diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux
index 9dd76ca08..36c21b520 100644
--- a/stdlib/source/test/aedifex/command/test.lux
+++ b/stdlib/source/test/aedifex/command/test.lux
@@ -5,6 +5,7 @@
[monad (#+ do)]]
[control
["." try]
+ ["." exception]
[concurrency
["." promise]]
[parser
@@ -14,7 +15,8 @@
[data
["." text ("#\." equivalence)]
[collection
- ["." dictionary]]]
+ ["." dictionary]
+ ["." list]]]
[math
["." random]]
[world
@@ -84,15 +86,15 @@
(: (shell.Simulation [])
(structure
(def: (on_read state)
- (#try.Failure "on_read"))
+ (exception.throw shell.no_more_output []))
(def: (on_error state)
- (#try.Failure "on_error"))
+ (exception.throw shell.no_more_output []))
(def: (on_write input state)
(#try.Failure "on_write"))
(def: (on_destroy state)
(#try.Failure "on_destroy"))
(def: (on_await state)
- (#try.Success [state (if (text.ends_with? " build" actual_command)
+ (#try.Success [state (if (list.any? (text\= "build") actual_arguments)
shell.normal
shell.error)]))))))
[])]