aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex
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
parentd747aada2d6df6538d0a88d70169f3757aef50af (diff)
Render XML to text in an indented form for human readability.
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/aedifex/cache.lux25
-rw-r--r--stdlib/source/test/aedifex/command/auto.lux3
-rw-r--r--stdlib/source/test/aedifex/command/build.lux11
-rw-r--r--stdlib/source/test/aedifex/command/deploy.lux34
-rw-r--r--stdlib/source/test/aedifex/command/deps.lux17
-rw-r--r--stdlib/source/test/aedifex/command/install.lux43
-rw-r--r--stdlib/source/test/aedifex/command/test.lux5
-rw-r--r--stdlib/source/test/aedifex/local.lux5
8 files changed, 90 insertions, 53 deletions
diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux
index 7923eb8c5..0bb0aea68 100644
--- a/stdlib/source/test/aedifex/cache.lux
+++ b/stdlib/source/test/aedifex/cache.lux
@@ -6,7 +6,9 @@
[control
["." try]
[concurrency
- ["." promise (#+ Promise)]]]
+ ["." promise (#+ Promise)]]
+ [parser
+ ["." environment]]]
[data
[binary (#+ Binary)]
["." text]
@@ -20,7 +22,8 @@
[math
["." random (#+ Random) ("#\." monad)]]
[world
- ["." file]]]
+ ["." file]
+ ["." program]]]
[//
["@." profile]
["@." artifact]
@@ -96,11 +99,14 @@
Test
(do {! random.monad}
[[dependency expected-package] ..package
+ home (random.ascii/alpha 5)
+ working-directory (random.ascii/alpha 5)
#let [fs (: (file.System Promise)
- (file.mock (\ file.default separator)))]]
+ (file.mock (\ file.default separator)))
+ program (program.async (program.mock environment.empty home working-directory))]]
(wrap (do promise.monad
- [wrote! (/.write-one fs dependency expected-package)
- read! (/.read-one fs dependency)]
+ [wrote! (/.write-one program fs dependency expected-package)
+ read! (/.read-one program fs dependency)]
(_.cover' [/.write-one /.read-one]
(<| (try.default false)
(do try.monad
@@ -114,11 +120,14 @@
Test
(do {! random.monad}
[expected ..resolution
+ home (random.ascii/alpha 5)
+ working-directory (random.ascii/alpha 5)
#let [fs (: (file.System Promise)
- (file.mock (\ file.default separator)))]]
+ (file.mock (\ file.default separator)))
+ program (program.async (program.mock environment.empty home working-directory))]]
(wrap (do promise.monad
- [wrote! (/.write-all fs expected)
- read! (/.read-all fs (dictionary.keys expected) //dependency/resolution.empty)]
+ [wrote! (/.write-all program fs expected)
+ read! (/.read-all program fs (dictionary.keys expected) //dependency/resolution.empty)]
(_.cover' [/.write-all /.read-all]
(<| (try.default false)
(do try.monad
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) [])
diff --git a/stdlib/source/test/aedifex/local.lux b/stdlib/source/test/aedifex/local.lux
index 1d90ff905..b95bf2e19 100644
--- a/stdlib/source/test/aedifex/local.lux
+++ b/stdlib/source/test/aedifex/local.lux
@@ -24,12 +24,13 @@
(<| (_.covering /._)
(do {! random.monad}
[sample @artifact.random
+ home (random.ascii/alpha 5)
#let [fs (: (file.System Promise)
(file.mock (\ file.default separator)))]]
($_ _.and
(_.cover [/.repository /.path]
- (let [path (/.path fs sample)]
- (and (text.starts-with? (/.repository fs)
+ (let [path (/.path fs home sample)]
+ (and (text.starts-with? (/.repository fs home)
path)
(text.ends-with? (//artifact.path fs sample)
path))))