aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/command
diff options
context:
space:
mode:
authorEduardo Julian2021-06-18 14:21:41 -0400
committerEduardo Julian2021-06-18 14:21:41 -0400
commita82bd1eabe94763162c2b0707d9c198fbe9835e3 (patch)
tree032473704af6e7db41e1f6dc87ab995788d8ab17 /stdlib/source/test/aedifex/command
parent519c0c0c71cdf7ce3dfc64b9781ab826760b3d94 (diff)
Refactored the machinery to make local macros into its own module.
Diffstat (limited to 'stdlib/source/test/aedifex/command')
-rw-r--r--stdlib/source/test/aedifex/command/build.lux9
-rw-r--r--stdlib/source/test/aedifex/command/deploy.lux36
-rw-r--r--stdlib/source/test/aedifex/command/deps.lux43
-rw-r--r--stdlib/source/test/aedifex/command/test.lux4
4 files changed, 64 insertions, 28 deletions
diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux
index 8a4df9a7e..85231ae33 100644
--- a/stdlib/source/test/aedifex/command/build.lux
+++ b/stdlib/source/test/aedifex/command/build.lux
@@ -4,6 +4,7 @@
[abstract
[monad (#+ do)]]
[control
+ [io (#+ IO)]
["." try]
["." exception]
[concurrency
@@ -37,7 +38,7 @@
["#/." resolution]]]]})
(def: #export good_shell
- (-> Any (Shell Promise))
+ (-> Any (Shell IO))
(shell.mock
(function (_ [actual_environment actual_working_directory actual_command actual_arguments])
(#try.Success
@@ -55,7 +56,7 @@
(#try.Success [state shell.normal]))))))))
(def: #export bad_shell
- (-> Any (Shell Promise))
+ (-> Any (Shell IO))
(shell.mock
(function (_ [actual_environment actual_working_directory actual_command actual_arguments])
(#try.Success
@@ -98,7 +99,7 @@
(<| (_.covering /._)
(do {! random.monad}
[#let [fs (file.mock (\ file.default separator))
- shell (..good_shell [])]
+ shell (shell.async (..good_shell []))]
program (random.ascii/alpha 5)
target (random.ascii/alpha 5)
home (random.ascii/alpha 5)
@@ -162,7 +163,7 @@
resolution ..resolution]
(wrap (do promise.monad
[verdict (do ///action.monad
- [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (..bad_shell []) resolution profile)
+ [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async (..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 617b3386a..cc99f2e48 100644
--- a/stdlib/source/test/aedifex/command/deploy.lux
+++ b/stdlib/source/test/aedifex/command/deploy.lux
@@ -17,7 +17,8 @@
["." binary]
["." text ("#\." equivalence)
["%" format (#+ format)]
- ["." encoding]]
+ [encoding
+ ["." utf8]]]
["." format #_
["#" binary]
["." tar]
@@ -108,31 +109,42 @@
(export.library fs)
(\ ! map (format.run tar.writer)))
- actual_pom (\ repository download (///repository/remote.uri artifact ///artifact/extension.pom))
- actual_library (\ repository download (///repository/remote.uri artifact ///artifact/extension.lux_library))
- actual_sha-1 (\ repository download (///repository/remote.uri artifact (format ///artifact/extension.lux_library ///artifact/extension.sha-1)))
- actual_md5 (\ repository download (///repository/remote.uri artifact (format ///artifact/extension.lux_library ///artifact/extension.md5)))
+ actual_pom (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact ///artifact/extension.pom))
+ actual_library (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact ///artifact/extension.lux_library))
+ actual_sha-1 (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.sha-1)))
+ actual_sha-1 (\ promise.monad wrap
+ (do try.monad
+ [actual_sha-1 (\ utf8.codec decode actual_sha-1)]
+ (\ ///hash.sha-1_codec decode actual_sha-1)))
+ actual_md5 (\ repository download (///repository/remote.uri (get@ #///artifact.version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.md5)))
+ actual_md5 (\ promise.monad wrap
+ (do try.monad
+ [actual_md5 (\ utf8.codec decode actual_md5)]
+ (\ ///hash.md5_codec decode actual_md5)))
- #let [deployed_library!
+ #let [succeeded!
+ (text\= //clean.success logging)
+
+ deployed_library!
(\ binary.equivalence =
expected_library
actual_library)
deployed_pom!
(\ binary.equivalence =
- (|> expected_pom (\ xml.codec encode) (\ encoding.utf8 encode))
+ (|> expected_pom (\ xml.codec encode) (\ utf8.codec encode))
actual_pom)
deployed_sha-1!
- (\ binary.equivalence =
- (///hash.data (///hash.sha-1 expected_library))
+ (\ ///hash.equivalence =
+ (///hash.sha-1 expected_library)
actual_sha-1)
deployed_md5!
- (\ binary.equivalence =
- (///hash.data (///hash.md5 expected_library))
+ (\ ///hash.equivalence =
+ (///hash.md5 expected_library)
actual_md5)]]
- (wrap (and (text\= //clean.success logging)
+ (wrap (and succeeded!
deployed_library!
deployed_pom!
deployed_sha-1!
diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux
index 99856c83c..8b5e3820e 100644
--- a/stdlib/source/test/aedifex/command/deps.lux
+++ b/stdlib/source/test/aedifex/command/deps.lux
@@ -14,10 +14,14 @@
["." environment]]]
[data
["." text ("#\." equivalence)
- ["%" format (#+ format)]]
+ ["%" format (#+ format)]
+ [encoding
+ ["." utf8]]]
[collection
["." dictionary]
- ["." set]]]
+ ["." set]]
+ [format
+ ["." xml]]]
[math
["." random (#+ Random)]]
[world
@@ -81,10 +85,14 @@
dependee_package (|> dependee_package
(set@ #///package.origin (#///repository/origin.Remote ""))
- (set@ #///package.pom [dependee_pom #///dependency/status.Unverified]))
+ (set@ #///package.pom [dependee_pom
+ (|> dependee_pom (\ xml.codec encode) (\ utf8.codec encode))
+ #///dependency/status.Unverified]))
depender_package (|> depender_package
(set@ #///package.origin (#///repository/origin.Remote ""))
- (set@ #///package.pom [depender_pom #///dependency/status.Unverified]))
+ (set@ #///package.pom [depender_pom
+ (|> depender_pom (\ xml.codec encode) (\ utf8.codec encode))
+ #///dependency/status.Unverified]))
fs (file.mock (\ file.default separator))
program (program.async (program.mock environment.empty home working_directory))]]
@@ -97,14 +105,29 @@
(///dependency/deployment.all local))
post (|> (\ ///.monoid identity)
(set@ #///.dependencies (set.from_list ///dependency.hash (list dependee depender)))
- (/.do! console local (list (///repository.mock ($///dependency/resolution.single depender_artifact depender_package) []))))
+ (/.do! console local (list (///repository.mock ($///dependency/resolution.single depender_artifact depender_package)
+ []))))
logging! (\ ///action.monad map
(text\= //clean.success)
- (!.use (\ console read_line) []))]
+ (!.use (\ console read_line) []))
+
+ #let [had_dependee_before!
+ (set.member? pre dependee_artifact)
+
+ lacked_depender_before!
+ (not (set.member? pre depender_artifact))
+
+ had_dependee_after!
+ (dictionary.key? post dependee)
+
+ had_depender_after!
+ (dictionary.key? post depender)]]
(wrap (and logging!
- (and (set.member? pre dependee_artifact)
- (not (set.member? pre depender_artifact)))
- (and (dictionary.key? post dependee)
- (dictionary.key? post depender)))))]
+
+ had_dependee_before!
+ lacked_depender_before!
+
+ had_dependee_after!
+ had_depender_after!)))]
(_.cover' [/.do!]
(try.default false verdict)))))))
diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux
index 2d077ab87..9dd76ca08 100644
--- a/stdlib/source/test/aedifex/command/test.lux
+++ b/stdlib/source/test/aedifex/command/test.lux
@@ -62,7 +62,7 @@
console (@version.echo "")]
(wrap (do promise.monad
[verdict (do ///action.monad
- [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (@build.good_shell []) resolution profile)
+ [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async (@build.good_shell [])) resolution profile)
build_start (!.use (\ console read_line) [])
build_end (!.use (\ console read_line) [])
test_start (!.use (\ console read_line) [])
@@ -96,7 +96,7 @@
shell.normal
shell.error)]))))))
[])]
- _ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs bad_shell resolution profile)
+ _ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async bad_shell) resolution profile)
build_start (!.use (\ console read_line) [])
build_end (!.use (\ console read_line) [])
test_start (!.use (\ console read_line) [])