aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/command/install.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-12-10 22:29:32 -0400
committerEduardo Julian2020-12-10 22:29:32 -0400
commit9af671a34728b35c48bff2ba163c371dc5084946 (patch)
treeec35f32b8f0cabec702708e0e3cc4462b587c752 /stdlib/source/test/aedifex/command/install.lux
parentd747aada2d6df6538d0a88d70169f3757aef50af (diff)
Render XML to text in an indented form for human readability.
Diffstat (limited to 'stdlib/source/test/aedifex/command/install.lux')
-rw-r--r--stdlib/source/test/aedifex/command/install.lux43
1 files changed, 26 insertions, 17 deletions
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))