aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/command/test.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-11-28 21:40:29 -0400
committerEduardo Julian2020-11-28 21:40:29 -0400
commit7444deb1b80d469280fcb0684d91c13f752a86d6 (patch)
tree132f8aa480dad400c20971f5e085876da8772b75 /stdlib/source/test/aedifex/command/test.lux
parenta02b7bf8ff358ccfa35b03272d28537aeac723ae (diff)
Re-named "_.claim" to "_.cover'".
Diffstat (limited to 'stdlib/source/test/aedifex/command/test.lux')
-rw-r--r--stdlib/source/test/aedifex/command/test.lux94
1 files changed, 94 insertions, 0 deletions
diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux
new file mode 100644
index 000000000..be1a89c83
--- /dev/null
+++ b/stdlib/source/test/aedifex/command/test.lux
@@ -0,0 +1,94 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." try]
+ [concurrency
+ ["." promise]]
+ [parser
+ ["." environment]]]
+ [data
+ [collection
+ ["." dictionary]]]
+ [math
+ ["." random]]
+ [world
+ ["." file]
+ ["." shell]]]
+ ["$." /// #_
+ ["#." package]]
+ {#program
+ ["." /
+ ["/#" // #_
+ ["#." build]
+ ["/#" // #_
+ ["#" profile (#+ Profile)]
+ ["#." action]
+ ["#." artifact
+ ["#/." type]]
+ ["#." dependency
+ ["#/." resolution]]]]]})
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (do {! random.monad}
+ [#let [fs (file.mock (:: file.default separator))
+ shell (shell.mock
+ (function (_ [actual-environment actual-working-directory actual-command actual-arguments])
+ (#try.Success
+ (: (shell.Simulation [])
+ (structure
+ (def: (on-read state)
+ (#try.Failure "on-read"))
+ (def: (on-error state)
+ (#try.Failure "on-error"))
+ (def: (on-write input state)
+ (#try.Failure "on-write"))
+ (def: (on-destroy state)
+ (#try.Failure "on-destroy"))
+ (def: (on-await state)
+ (#try.Success [state shell.normal]))))))
+ [])]
+ program (random.ascii/alpha 5)
+ target (random.ascii/alpha 5)
+ working-directory (random.ascii/alpha 5)
+ #let [empty-profile (: Profile
+ (:: ///.monoid identity))
+ with-target (: (-> Profile Profile)
+ (set@ #///.target (#.Some target)))
+ with-program (: (-> Profile Profile)
+ (set@ #///.program (#.Some program)))
+
+ profile (|> empty-profile
+ with-program
+ with-target)
+
+ no-working-directory environment.empty
+
+ environment (dictionary.put "user.dir" working-directory environment.empty)]]
+ ($_ _.and
+ (do !
+ [lux-version (random.ascii/alpha 5)
+ [_ compiler-package] $///package.random
+ #let [jvm-compiler {#///dependency.artifact {#///artifact.group //build.lux-group
+ #///artifact.name //build.jvm-compiler-name
+ #///artifact.version lux-version}
+ #///dependency.type ///artifact/type.lux-library}
+ js-compiler {#///dependency.artifact {#///artifact.group //build.lux-group
+ #///artifact.name //build.js-compiler-name
+ #///artifact.version lux-version}
+ #///dependency.type ///artifact/type.lux-library}]
+ compiler-dependency (random.either (wrap jvm-compiler)
+ (wrap js-compiler))]
+ (wrap (do promise.monad
+ [verdict (do ///action.monad
+ [#let [resolution (|> ///dependency/resolution.empty
+ (dictionary.put compiler-dependency compiler-package))]
+ _ (/.do! environment fs shell resolution profile)]
+ (wrap true))]
+ (_.cover' [/.do!]
+ (try.default false verdict)))))
+ ))))