diff options
Diffstat (limited to 'stdlib/source/test/aedifex/command')
-rw-r--r-- | stdlib/source/test/aedifex/command/auto.lux | 3 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/build.lux | 11 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/deploy.lux | 34 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/deps.lux | 17 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/install.lux | 43 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/test.lux | 5 |
6 files changed, 70 insertions, 43 deletions
diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index 48b2a7eb3..c43d8642f 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -80,6 +80,7 @@ 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) @@ -107,7 +108,7 @@ (do promise.monad [outcome ((/.do! watcher command) (@version.echo "") - (program.async (program.mock environment.empty working-directory)) + (program.async (program.mock environment.empty home working-directory)) fs (@build.good-shell []) resolution diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 74508ef3d..025d01c0b 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -101,6 +101,7 @@ shell (..good-shell [])] program (random.ascii/alpha 5) target (random.ascii/alpha 5) + home (random.ascii/alpha 5) working-directory (random.ascii/alpha 5) #let [empty-profile (: Profile (\ ///.monoid identity)) @@ -114,7 +115,7 @@ with-target)]] ($_ _.and (wrap (do promise.monad - [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty working-directory)) fs shell ///dependency/resolution.empty + [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working-directory)) fs shell ///dependency/resolution.empty (with-target empty-profile))] (_.cover' [/.no-specified-program] (case outcome @@ -124,7 +125,7 @@ (#try.Failure error) (exception.match? /.no-specified-program error))))) (wrap (do promise.monad - [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty working-directory)) fs shell ///dependency/resolution.empty + [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working-directory)) fs shell ///dependency/resolution.empty (with-program empty-profile))] (_.cover' [/.no-specified-target] (case outcome @@ -134,7 +135,7 @@ (#try.Failure error) (exception.match? /.no-specified-target error))))) (wrap (do promise.monad - [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty working-directory)) fs shell ///dependency/resolution.empty profile)] + [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working-directory)) fs shell ///dependency/resolution.empty profile)] (_.cover' [/.Compiler /.no-available-compiler] (case outcome (#try.Success _) @@ -147,7 +148,7 @@ resolution ..resolution] (wrap (do promise.monad [verdict (do ///action.monad - [_ (/.do! console (program.async (program.mock environment.empty working-directory)) fs shell resolution profile) + [_ (/.do! console (program.async (program.mock environment.empty home working-directory)) fs shell resolution profile) start (!.use (\ console read-line) []) end (!.use (\ console read-line) [])] (wrap (and (text\= /.start start) @@ -161,7 +162,7 @@ resolution ..resolution] (wrap (do promise.monad [verdict (do ///action.monad - [_ (/.do! console (program.async (program.mock environment.empty working-directory)) fs (..bad-shell []) resolution profile) + [_ (/.do! console (program.async (program.mock environment.empty home working-directory)) fs (..bad-shell []) resolution profile) start (!.use (\ console read-line) []) end (!.use (\ console read-line) [])] (wrap (and (text\= /.start start) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index 773069322..eafd1f968 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -9,7 +9,9 @@ [concurrency ["." promise (#+ Promise)]] [security - ["!" capability]]] + ["!" capability]] + [parser + ["." environment (#+ Environment)]]] [data ["." maybe] ["." binary] @@ -26,7 +28,8 @@ [math ["." random (#+ Random)]] [world - ["." file (#+ Path File)]]] + ["." file (#+ Path File)] + ["." program (#+ Program)]]] [program [compositor ["." export]]] @@ -66,17 +69,19 @@ (file.get-file promise.monad fs (format head (\ fs separator) head ".lux")))] (recur tail))))) -(def: (execute! repository fs identity artifact profile) - (-> (Repository Promise) (file.System Promise) +(def: (execute! program repository fs identity artifact profile) + (-> (Program Promise) (Repository Promise) (file.System Promise) Identity Artifact ///.Profile (Promise (Try Text))) - (do ///action.monad - [#let [console (@version.echo "")] - _ (..make-sources! fs (get@ #///.sources profile)) - _ (: (Promise (Try Path)) - (file.make-directories promise.monad fs (///local.repository fs))) - _ (/.do! console repository fs identity artifact profile)] - (!.use (\ console read-line) []))) + (do promise.monad + [home (\ program home [])] + (do ///action.monad + [#let [console (@version.echo "")] + _ (..make-sources! fs (get@ #///.sources profile)) + _ (: (Promise (Try Path)) + (file.make-directories promise.monad fs (///local.repository fs home))) + _ (/.do! console repository fs identity artifact profile)] + (!.use (\ console read-line) [])))) (def: #export test Test @@ -91,12 +96,15 @@ @profile.random) identity @repository.identity + home (random.ascii/alpha 5) + working-directory (random.ascii/alpha 5) #let [repository (///repository.mock (@repository.simulation identity) @repository.empty) - fs (file.mock (\ file.default separator))]] + fs (file.mock (\ file.default separator)) + program (program.async (program.mock environment.empty home working-directory))]] (wrap (do {! promise.monad} [verdict (do {! ///action.monad} - [logging (..execute! repository fs identity artifact profile) + [logging (..execute! program repository fs identity artifact profile) expected-library (|> profile (get@ #///.sources) set.to-list diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 5b9dd87da..292185a28 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -9,7 +9,9 @@ [concurrency ["." promise]] [security - ["!" capability]]] + ["!" capability]] + [parser + ["." environment]]] [data ["." text ("#\." equivalence) ["%" format (#+ format)]] @@ -19,6 +21,7 @@ [math ["." random (#+ Random)]] [world + ["." program] ["." file]]] ["." // #_ ["@." version] @@ -47,7 +50,10 @@ Test (<| (_.covering /._) (do random.monad - [dependee-artifact $///artifact.random + [home (random.ascii/alpha 5) + working-directory (random.ascii/alpha 5) + + dependee-artifact $///artifact.random depender-artifact (random.filter (predicate.complement (\ ///artifact.equivalence = dependee-artifact)) $///artifact.random) @@ -77,16 +83,17 @@ (set@ #///package.origin #///package.Remote) (set@ #///package.pom depender-pom)) - fs (file.mock (\ file.default separator))]] + fs (file.mock (\ file.default separator)) + program (program.async (program.mock environment.empty home working-directory))]] (wrap (do promise.monad [verdict (do ///action.monad [#let [console (@version.echo "")] pre (|> ///dependency/resolution.empty (dictionary.put dependee dependee-package) - (///cache.write-all fs)) + (///cache.write-all program fs)) post (|> (\ ///.monoid identity) (set@ #///.dependencies (set.from-list ///dependency.hash (list dependee depender))) - (/.do! console fs (list (///repository.mock ($///dependency/resolution.single depender-artifact depender-package) [])))) + (/.do! program console fs (list (///repository.mock ($///dependency/resolution.single depender-artifact depender-package) [])))) logging! (\ ///action.monad map (text\= //clean.success) (!.use (\ console read-line) []))] diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index 2dbddeaa3..9ffa65bab 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -9,7 +9,9 @@ [concurrency ["." promise (#+ Promise)]] [security - ["!" capability]]] + ["!" capability]] + [parser + ["." environment (#+ Environment)]]] [data ["." maybe] ["." binary] @@ -23,7 +25,8 @@ [math ["." random (#+ Random)]] [world - ["." file (#+ Path File)]]] + ["." file (#+ Path File)] + ["." program (#+ Program)]]] [// ["@." version] [// @@ -58,15 +61,17 @@ (file.get-file promise.monad fs (format head (\ fs separator) head ".lux")))] (recur tail))))) -(def: (execute! fs sample) - (-> (file.System Promise) ///.Profile (Promise (Try Text))) - (do ///action.monad - [#let [console (@version.echo "")] - _ (..make-sources! fs (get@ #///.sources sample)) - _ (: (Promise (Try Path)) - (file.make-directories promise.monad fs (///local.repository fs))) - _ (/.do! console fs sample)] - (!.use (\ console read-line) []))) +(def: (execute! program fs sample) + (-> (Program Promise) (file.System Promise) ///.Profile (Promise (Try Text))) + (do promise.monad + [home (\ program home [])] + (do ///action.monad + [#let [console (@version.echo "")] + _ (..make-sources! fs (get@ #///.sources sample)) + _ (: (Promise (Try Path)) + (file.make-directories promise.monad fs (///local.repository fs home))) + _ (/.do! program console fs sample)] + (!.use (\ console read-line) [])))) (def: #export test Test @@ -74,13 +79,16 @@ (do {! random.monad} [identity @artifact.random sample (\ ! map (set@ #///.identity (#.Some identity)) - @profile.random)] + @profile.random) + home (random.ascii/alpha 5) + working-directory (random.ascii/alpha 5)] ($_ _.and (wrap (do {! promise.monad} - [#let [fs (file.mock (\ file.default separator))] + [#let [fs (file.mock (\ file.default separator)) + program (program.async (program.mock environment.empty home working-directory))] verdict (do ///action.monad - [logging (..execute! fs sample) - #let [artifact-path (format (///local.path fs identity) + [logging (..execute! program fs sample) + #let [artifact-path (format (///local.path fs home identity) (\ fs separator) (///artifact.identity identity)) library-path (format artifact-path ///artifact/extension.lux-library) @@ -98,8 +106,9 @@ (_.cover' [/.do!] (try.default false verdict)))) (wrap (do {! promise.monad} - [#let [fs (file.mock (\ file.default separator))] - logging (..execute! fs (set@ #///.identity #.None sample))] + [#let [fs (file.mock (\ file.default separator)) + program (program.async (program.mock environment.empty home working-directory))] + logging (..execute! program fs (set@ #///.identity #.None sample))] (_.cover' [/.failure] (|> logging (try\map (text\= /.failure)) diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index f87e70e85..b63662bc0 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -44,6 +44,7 @@ (do {! random.monad} [program (random.ascii/alpha 5) target (random.ascii/alpha 5) + home (random.ascii/alpha 5) working-directory (random.ascii/alpha 5) #let [empty-profile (: Profile (\ ///.monoid identity)) @@ -61,7 +62,7 @@ console (@version.echo "")] (wrap (do promise.monad [verdict (do ///action.monad - [_ (/.do! console (program.async (program.mock environment.empty working-directory)) fs (@build.good-shell []) resolution profile) + [_ (/.do! console (program.async (program.mock environment.empty home working-directory)) fs (@build.good-shell []) resolution profile) build-start (!.use (\ console read-line) []) build-end (!.use (\ console read-line) []) test-start (!.use (\ console read-line) []) @@ -95,7 +96,7 @@ shell.normal shell.error)])))))) [])] - _ (/.do! console (program.async (program.mock environment.empty working-directory)) fs bad-shell resolution profile) + _ (/.do! console (program.async (program.mock environment.empty home working-directory)) fs bad-shell resolution profile) build-start (!.use (\ console read-line) []) build-end (!.use (\ console read-line) []) test-start (!.use (\ console read-line) []) |