aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex
diff options
context:
space:
mode:
authorEduardo Julian2021-07-11 01:51:04 -0400
committerEduardo Julian2021-07-11 01:51:04 -0400
commitabe24425ced15fd784ef6c62d6f186af72b491db (patch)
tree42b6e3cbd179c83fae8941fa4b128b13afc766f5 /stdlib/source/test/aedifex
parent4610968193df10af12c91f699fec39aeb3ef703a (diff)
Re-named ":coerce" to ":as" since it technically doesn't do coercions.
Diffstat (limited to 'stdlib/source/test/aedifex')
-rw-r--r--stdlib/source/test/aedifex/command/install.lux9
-rw-r--r--stdlib/source/test/aedifex/profile.lux1
-rw-r--r--stdlib/source/test/aedifex/repository.lux2
-rw-r--r--stdlib/source/test/aedifex/repository/local.lux51
4 files changed, 60 insertions, 3 deletions
diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux
index 5800bca6d..0e8a95526 100644
--- a/stdlib/source/test/aedifex/command/install.lux
+++ b/stdlib/source/test/aedifex/command/install.lux
@@ -67,10 +67,11 @@
sample (\ ! map (set@ #///.identity (#.Some identity))
$profile.random)
home (random.ascii/alpha 5)
- working_directory (random.ascii/alpha 5)]
+ working_directory (random.ascii/alpha 5)
+ #let [/ (\ file.default separator)]]
($_ _.and
(wrap (do {! promise.monad}
- [#let [fs (file.mock (\ file.default separator))
+ [#let [fs (file.mock /)
program (program.async (program.mock environment.empty home working_directory))
artifact_path (///local.uri (get@ #///artifact.version identity) identity)
@@ -80,9 +81,11 @@
[succeeded! (\ ! map (text\= /.success)
(..execute! program fs sample))
library_exists! (|> library_path
+ (format home /)
(\ fs file?)
(\ promise.monad map exception.return))
pom_exists! (|> pom_path
+ (format home /)
(\ fs file?)
(\ promise.monad map exception.return))]
(wrap (and succeeded!
@@ -91,7 +94,7 @@
(_.cover' [/.do! /.success]
(try.default false verdict))))
(wrap (do {! promise.monad}
- [#let [fs (file.mock (\ file.default separator))
+ [#let [fs (file.mock /)
program (program.async (program.mock environment.empty home working_directory))]
logging (..execute! program fs (set@ #///.identity #.None sample))]
(_.cover' [/.failure]
diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux
index 3410255f5..0a0ba8642 100644
--- a/stdlib/source/test/aedifex/profile.lux
+++ b/stdlib/source/test/aedifex/profile.lux
@@ -124,6 +124,7 @@
(random.maybe ..info)
(..set_of text.hash ..repository)
(..set_of //dependency.hash @dependency.random)
+ @dependency.random
(..set_of text.hash ..source)
..target
(random.maybe (random.ascii/alpha 1))
diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux
index d16734a60..f9a4eeda6 100644
--- a/stdlib/source/test/aedifex/repository.lux
+++ b/stdlib/source/test/aedifex/repository.lux
@@ -24,6 +24,7 @@
["." / #_
["#." identity]
["#." origin]
+ ["#." local]
["#." remote]
[//
["@." artifact]]]
@@ -100,5 +101,6 @@
/identity.test
/origin.test
+ /local.test
/remote.test
)))
diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux
new file mode 100644
index 000000000..946494437
--- /dev/null
+++ b/stdlib/source/test/aedifex/repository/local.lux
@@ -0,0 +1,51 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." try ("#\." functor)]
+ [parser
+ ["." environment]]
+ [concurrency
+ ["." promise]]]
+ [data
+ ["." binary ("#\." equivalence)]
+ [text
+ [encoding
+ ["." utf8]]]]
+ [math
+ ["." random]]
+ [world
+ ["." file]
+ ["." program]]]
+ {#program
+ ["." /]})
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (do {! random.monad}
+ [/ (random.ascii/upper 1)
+ home (random.ascii/lower 10)
+ working_directory (random.ascii/lower 10)
+ #let [fs (file.mock /)
+ program (program.async (program.mock environment.empty home working_directory))
+ repo (/.repository program fs)]
+
+ uri (random.ascii/lower 10)
+ expected (\ ! map (\ utf8.codec encode)
+ (random.ascii/lower 10))]
+ ($_ _.and
+ (wrap (do promise.monad
+ [before_upload (\ repo download uri)
+ _ (\ repo upload uri expected)
+ actual (\ repo download uri)]
+ (_.cover' [/.repository]
+ (and (case before_upload
+ (#try.Success _) false
+ (#try.Failure _) true)
+ (|> actual
+ (try\map (binary\= expected))
+ (try.default false))))))
+ ))))