aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/command
diff options
context:
space:
mode:
authorEduardo Julian2020-11-24 05:18:04 -0400
committerEduardo Julian2020-11-24 05:18:04 -0400
commitc4bbfea18d995948012f45a6afda7a6e6ba56f84 (patch)
treeb3c425471830788965776fd173169f084d9f6af4 /stdlib/source/test/aedifex/command
parentd89d837de3475b75587a4293e094d755d2cd4626 (diff)
Better error messages when re-using a name when making a definition.
Diffstat (limited to 'stdlib/source/test/aedifex/command')
-rw-r--r--stdlib/source/test/aedifex/command/clean.lux6
-rw-r--r--stdlib/source/test/aedifex/command/deploy.lux4
-rw-r--r--stdlib/source/test/aedifex/command/deps.lux88
-rw-r--r--stdlib/source/test/aedifex/command/install.lux4
-rw-r--r--stdlib/source/test/aedifex/command/pom.lux8
5 files changed, 99 insertions, 11 deletions
diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux
index 73207fa14..ba9431b95 100644
--- a/stdlib/source/test/aedifex/command/clean.lux
+++ b/stdlib/source/test/aedifex/command/clean.lux
@@ -17,7 +17,7 @@
[number
["n" nat]]
[collection
- ["." list ("#@." functor)]
+ ["." list ("#\." functor)]
["." set]]]
[math
["." random (#+ Random)]]
@@ -45,7 +45,7 @@
[count (:: ! map (n.% 10) random.nat)
names (random.set text.hash count ..node-name)
contents (random.list count (_binary.random 100))]
- (wrap (list.zip/2 (list@map (|>> (format prefix)) (set.to-list names))
+ (wrap (list.zip/2 (list\map (|>> (format prefix)) (set.to-list names))
contents))))
(def: (create-file! fs [path content])
@@ -77,7 +77,7 @@
[directory-exists? (..directory-exists? fs directory-path)
files-exist? (: (Action (List Bit))
(|> files
- (list@map product.left)
+ (list\map product.left)
(monad.map ///action.monad (..file-exists? fs))))]
(wrap (and directory-exists?
(list.every? (|>>) files-exist?)))))
diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux
index 20718f915..b27d3c0a7 100644
--- a/stdlib/source/test/aedifex/command/deploy.lux
+++ b/stdlib/source/test/aedifex/command/deploy.lux
@@ -4,7 +4,7 @@
[abstract
["." monad (#+ do)]]
[control
- ["." try (#+ Try) ("#@." functor)]
+ ["." try (#+ Try) ("#\." functor)]
["." exception]
[concurrency
["." promise (#+ Promise)]]
@@ -13,7 +13,7 @@
[data
["." maybe]
["." binary]
- ["." text ("#@." equivalence)
+ ["." text ("#\." equivalence)
["%" format (#+ format)]
["." encoding]]
["." format #_
diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux
new file mode 100644
index 000000000..c0617188d
--- /dev/null
+++ b/stdlib/source/test/aedifex/command/deps.lux
@@ -0,0 +1,88 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]
+ ["." predicate]]
+ [control
+ ["." try]
+ [concurrency
+ ["." promise]]]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." dictionary]
+ ["." set]]]
+ [math
+ ["." random (#+ Random)]]
+ [world
+ ["." file]]]
+ ["$." /// #_
+ ["#." package]
+ ["#." artifact]
+ ["#." dependency #_
+ ["#/." resolution]]]
+ {#program
+ ["." /
+ ["//#" /// #_
+ ["#" profile]
+ ["#." action]
+ ["#." pom]
+ ["#." package]
+ ["#." cache]
+ ["#." repository]
+ ["#." artifact
+ ["#/." type]]
+ ["#." dependency
+ ["#/." resolution]]]]})
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (do random.monad
+ [dependee-artifact $///artifact.random
+ depender-artifact (random.filter (predicate.complement
+ (:: ///artifact.equivalence = dependee-artifact))
+ $///artifact.random)
+
+ [_ dependee-package] $///package.random
+ [_ depender-package] $///package.random
+
+ #let [dependee {#///dependency.artifact dependee-artifact
+ #///dependency.type ///artifact/type.lux-library}
+ depender {#///dependency.artifact depender-artifact
+ #///dependency.type ///artifact/type.lux-library}
+
+ dependee-pom (|> (:: ///.monoid identity)
+ (set@ #///.identity (#.Some dependee-artifact))
+ ///pom.write
+ try.assume)
+ depender-pom (|> (:: ///.monoid identity)
+ (set@ #///.identity (#.Some depender-artifact))
+ (set@ #///.dependencies (set.from-list ///dependency.hash (list dependee)))
+ ///pom.write
+ try.assume)
+
+ dependee-package (|> dependee-package
+ (set@ #///package.origin #///package.Remote)
+ (set@ #///package.pom dependee-pom))
+ depender-package (|> depender-package
+ (set@ #///package.origin #///package.Remote)
+ (set@ #///package.pom depender-pom))
+
+ fs (file.mock (:: file.default separator))]]
+ (wrap (do promise.monad
+ [verdict (do ///action.monad
+ [pre (|> ///dependency/resolution.empty
+ (dictionary.put dependee dependee-package)
+ (///cache.write-all fs))
+ post (|> (:: ///.monoid identity)
+ (set@ #///.dependencies (set.from-list ///dependency.hash (list dependee depender)))
+ (/.do! fs (list (///repository.mock ($///dependency/resolution.single depender-artifact depender-package) []))))]
+ (wrap (and (and (set.member? pre dependee-artifact)
+ (not (set.member? pre depender-artifact)))
+ (and (not (set.member? post dependee-artifact))
+ (set.member? post depender-artifact)))))]
+ (_.claim [/.do!]
+ (try.default false verdict)))))))
diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux
index 60a46116d..bcc6bb039 100644
--- a/stdlib/source/test/aedifex/command/install.lux
+++ b/stdlib/source/test/aedifex/command/install.lux
@@ -4,7 +4,7 @@
[abstract
["." monad (#+ do)]]
[control
- ["." try (#+ Try) ("#@." functor)]
+ ["." try (#+ Try)]
["." exception]
[concurrency
["." promise (#+ Promise)]]
@@ -13,7 +13,7 @@
[data
["." maybe]
["." binary]
- ["." text ("#@." equivalence)
+ ["." text
["%" format (#+ format)]
["." encoding]]
[format
diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux
index c973678cc..dc05cced0 100644
--- a/stdlib/source/test/aedifex/command/pom.lux
+++ b/stdlib/source/test/aedifex/command/pom.lux
@@ -4,14 +4,14 @@
[abstract
[monad (#+ do)]]
[control
- ["." try (#+ Try) ("#@." functor)]
+ ["." try (#+ Try) ("#\." functor)]
[concurrency
["." promise (#+ Promise)]]
[security
["!" capability]]]
[data
["." binary]
- ["." text ("#@." equivalence)
+ ["." text ("#\." equivalence)
["." encoding]]
[format
["." xml]]]
@@ -41,14 +41,14 @@
(do !
[verdict (do ///action.monad
[expected (|> (///pom.write sample)
- (try@map (|>> (:: xml.codec encode) encoding.to-utf8))
+ (try\map (|>> (:: xml.codec encode) encoding.to-utf8))
(:: ! wrap))
file (: (Promise (Try (File Promise)))
(file.get-file promise.monad fs path))
actual (!.use (:: file content) [])
#let [expected-path!
- (text@= ///pom.file path)
+ (text\= ///pom.file path)
expected-content!
(:: binary.equivalence = expected actual)]]