aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/aedifex.lux12
-rw-r--r--stdlib/source/test/aedifex/command/auto.lux43
-rw-r--r--stdlib/source/test/aedifex/command/build.lux12
-rw-r--r--stdlib/source/test/aedifex/command/clean.lux54
-rw-r--r--stdlib/source/test/aedifex/command/deploy.lux4
-rw-r--r--stdlib/source/test/aedifex/command/deps.lux7
-rw-r--r--stdlib/source/test/aedifex/command/install.lux4
-rw-r--r--stdlib/source/test/aedifex/command/pom.lux4
-rw-r--r--stdlib/source/test/aedifex/command/test.lux2
-rw-r--r--stdlib/source/test/aedifex/package.lux64
-rw-r--r--stdlib/source/test/aedifex/profile.lux2
11 files changed, 109 insertions, 99 deletions
diff --git a/stdlib/source/test/aedifex.lux b/stdlib/source/test/aedifex.lux
index b7d0d29d9..8757242c5 100644
--- a/stdlib/source/test/aedifex.lux
+++ b/stdlib/source/test/aedifex.lux
@@ -15,9 +15,9 @@
["#." input]
["#." local]
["#." metadata]
- ## ["#." package]
- ## ["#." profile]
- ## ["#." project]
+ ["#." package]
+ ["#." profile]
+ ["#." project]
## ["#." parser]
## ["#." pom]
## ["#." repository]
@@ -43,10 +43,10 @@
/input.test
/local.test
/metadata.test
+ /package.test
+ /profile.test
+ /project.test
- ## /package.test
- ## /profile.test
- ## /project.test
## /parser.test
## /pom.test
## /repository.test
diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux
index c23519bcc..7ef74d2c0 100644
--- a/stdlib/source/test/aedifex/command/auto.lux
+++ b/stdlib/source/test/aedifex/command/auto.lux
@@ -14,7 +14,9 @@
["!" capability]]]
[data
["." text
- ["%" format (#+ format)]]
+ ["%" format (#+ format)]
+ [encoding
+ ["." utf8]]]
[collection
["." dictionary]
["." set]
@@ -27,7 +29,7 @@
[console (#+ Console)]
["." shell (#+ Shell)]
["." program (#+ Program)]
- ["." file (#+ Path)
+ ["." file (#+ Path File)
["." watch]]]]
["." // #_
["@." version]
@@ -47,28 +49,22 @@
["#." dependency
["#/." resolution (#+ Resolution)]]]]]})
-(def: (command end_signal dummy_files)
- (-> Text (List Path)
- [(Atom [Nat (List Path)])
+(def: (command expected_runs end_signal dummy_file)
+ (-> Nat Text (File Promise)
+ [(Atom Nat)
(-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command Any))])
- (let [@runs (: (Atom [Nat (List Path)])
- (atom.atom [0 dummy_files]))]
+ (let [@runs (: (Atom Nat)
+ (atom.atom 0))]
[@runs
(function (_ console program fs shell resolution profile)
(do {! promise.monad}
- [[_ [runs remaining_files]] (promise.future
- (atom.update (function (_ [runs remaining_files])
- [(inc runs) remaining_files])
- @runs))]
- (case remaining_files
- #.Nil
+ [[_ actual_runs] (promise.future (atom.update inc @runs))]
+ (if (n.= expected_runs actual_runs)
(wrap (#try.Failure end_signal))
-
- (#.Cons head tail)
(do (try.with !)
- [_ (!.use (\ fs create_file) [head])]
+ [_ (!.use (\ dummy_file over_write) (\ utf8.codec encode (%.nat actual_runs)))]
(do !
- [_ (promise.future (atom.write [runs tail] @runs))]
+ [_ (promise.future (atom.write actual_runs @runs))]
(wrap (#try.Success [])))))))]))
(def: #export test
@@ -85,7 +81,7 @@
#let [empty_profile (: Profile
(\ ///.monoid identity))
with_target (: (-> Profile Profile)
- (set@ #///.target (#.Some target)))
+ (set@ #///.target target))
with_program (: (-> Profile Profile)
(set@ #///.program (#.Some program)))
@@ -98,15 +94,14 @@
working_directory (random.ascii/alpha 5)
expected_runs (\ ! map (|>> (n.% 10) (n.max 2)) random.nat)
- dummy_files (|> (random.ascii/alpha 5)
- (random.set text.hash (dec expected_runs))
- (\ ! map (|>> set.to_list (list\map (|>> (format source /))))))
+ dummy_path (\ ! map (|>> (format source /)) (random.ascii/alpha 5))
resolution @build.resolution]
($_ _.and
(wrap (do promise.monad
[verdict (do ///action.monad
- [#let [[@runs command] (..command end_signal dummy_files)]
- _ (!.use (\ fs create_directory) [source])
+ [_ (!.use (\ fs create_directory) [source])
+ dummy_file (!.use (\ fs create_file) [dummy_path])
+ #let [[@runs command] (..command expected_runs end_signal dummy_file)]
_ (\ watcher poll [])]
(do promise.monad
[outcome ((/.do! 1 watcher command)
@@ -116,7 +111,7 @@
(shell.async (@build.good_shell []))
resolution
profile)
- [actual_runs _] (promise.future (atom.read @runs))]
+ actual_runs (promise.future (atom.read @runs))]
(wrap (#try.Success (and (n.= expected_runs actual_runs)
(case outcome
(#try.Failure error)
diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux
index 234343fea..7fd8c3eb3 100644
--- a/stdlib/source/test/aedifex/command/build.lux
+++ b/stdlib/source/test/aedifex/command/build.lux
@@ -109,7 +109,7 @@
#let [empty_profile (: Profile
(\ ///.monoid identity))
with_target (: (-> Profile Profile)
- (set@ #///.target (#.Some target)))
+ (set@ #///.target target))
with_program (: (-> Profile Profile)
(set@ #///.program (#.Some program)))
@@ -128,16 +128,6 @@
(#try.Failure error)
(exception.match? /.no_specified_program error)))))
(wrap (do promise.monad
- [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
- (#try.Success _)
- false
-
- (#try.Failure error)
- (exception.match? /.no_specified_target error)))))
- (wrap (do promise.monad
[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
diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux
index d98473259..705cca7f2 100644
--- a/stdlib/source/test/aedifex/command/clean.lux
+++ b/stdlib/source/test/aedifex/command/clean.lux
@@ -99,35 +99,25 @@
sub_files (..files (format sub_path /))
dummy @profile.random]
- ($_ _.and
- (wrap (do promise.monad
- [#let [console (@version.echo "")]
- verdict (do {! (try.with promise.monad)}
- [_ (/.do! console fs (set@ #///.target #.None dummy))]
- (\ ! map (text\= /.failure)
- (!.use (\ console read_line) [])))]
- (_.cover' [/.failure]
- (try.default false verdict))))
- (wrap (do promise.monad
- [#let [console (@version.echo "")]
- verdict (do {! (try.with promise.monad)}
- [_ (..create_directory! fs target_path direct_files)
- _ (..create_directory! fs sub_path sub_files)
- context_exists!/pre (..directory_exists? fs context)
- target_exists!/pre (..assets_exist? fs target_path direct_files)
- sub_exists!/pre (..assets_exist? fs sub_path sub_files)
- _ (/.do! console fs (set@ #///.target (#.Some target_path) dummy))
- context_exists!/post (..directory_exists? fs context)
- target_exists!/post (..assets_exist? fs target_path direct_files)
- sub_exists!/post (..assets_exist? fs sub_path sub_files)
- logging (!.use (\ console read_line) [])]
- (wrap (and (and context_exists!/pre
- context_exists!/post)
- (and target_exists!/pre
- (not target_exists!/post))
- (and sub_exists!/pre
- (not sub_exists!/post))
- (text\= /.success logging))))]
- (_.cover' [/.do! /.success]
- (try.default false verdict))))
- ))))
+ (wrap (do promise.monad
+ [#let [console (@version.echo "")]
+ verdict (do {! (try.with promise.monad)}
+ [_ (..create_directory! fs target_path direct_files)
+ _ (..create_directory! fs sub_path sub_files)
+ context_exists!/pre (..directory_exists? fs context)
+ target_exists!/pre (..assets_exist? fs target_path direct_files)
+ sub_exists!/pre (..assets_exist? fs sub_path sub_files)
+ _ (/.do! console fs (set@ #///.target target_path dummy))
+ context_exists!/post (..directory_exists? fs context)
+ target_exists!/post (..assets_exist? fs target_path direct_files)
+ sub_exists!/post (..assets_exist? fs sub_path sub_files)
+ logging (!.use (\ console read_line) [])]
+ (wrap (and (and context_exists!/pre
+ context_exists!/post)
+ (and target_exists!/pre
+ (not target_exists!/post))
+ (and sub_exists!/pre
+ (not sub_exists!/post))
+ (text\= (/.success target_path) logging))))]
+ (_.cover' [/.do! /.success]
+ (try.default false verdict)))))))
diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux
index cc99f2e48..7e1bf166e 100644
--- a/stdlib/source/test/aedifex/command/deploy.lux
+++ b/stdlib/source/test/aedifex/command/deploy.lux
@@ -123,7 +123,7 @@
(\ ///hash.md5_codec decode actual_md5)))
#let [succeeded!
- (text\= //clean.success logging)
+ (text\= /.success logging)
deployed_library!
(\ binary.equivalence =
@@ -149,5 +149,5 @@
deployed_pom!
deployed_sha-1!
deployed_md5!)))]
- (_.cover' [/.do!]
+ (_.cover' [/.do! /.success]
(try.default false verdict)))))))
diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux
index 8b5e3820e..2b4898dd3 100644
--- a/stdlib/source/test/aedifex/command/deps.lux
+++ b/stdlib/source/test/aedifex/command/deps.lux
@@ -107,9 +107,6 @@
(set@ #///.dependencies (set.from_list ///dependency.hash (list dependee depender)))
(/.do! console local (list (///repository.mock ($///dependency/resolution.single depender_artifact depender_package)
[]))))
- logging! (\ ///action.monad map
- (text\= //clean.success)
- (!.use (\ console read_line) []))
#let [had_dependee_before!
(set.member? pre dependee_artifact)
@@ -122,9 +119,7 @@
had_depender_after!
(dictionary.key? post depender)]]
- (wrap (and logging!
-
- had_dependee_before!
+ (wrap (and had_dependee_before!
lacked_depender_before!
had_dependee_after!
diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux
index 33ee7192d..8096fc2b2 100644
--- a/stdlib/source/test/aedifex/command/install.lux
+++ b/stdlib/source/test/aedifex/command/install.lux
@@ -92,7 +92,7 @@
library_path (format artifact_path ///artifact/extension.lux_library)
pom_path (format artifact_path ///artifact/extension.pom)]
- #let [succeeded! (text\= //clean.success logging)]
+ #let [succeeded! (text\= /.success logging)]
library_exists! (\ promise.monad map
exception.return
(file.file_exists? promise.monad fs library_path))
@@ -102,7 +102,7 @@
(wrap (and succeeded!
library_exists!
pom_exists!)))]
- (_.cover' [/.do!]
+ (_.cover' [/.do! /.success]
(try.default false verdict))))
(wrap (do {! promise.monad}
[#let [fs (file.mock (\ file.default separator))
diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux
index c368d5f84..f7f182225 100644
--- a/stdlib/source/test/aedifex/command/pom.lux
+++ b/stdlib/source/test/aedifex/command/pom.lux
@@ -54,7 +54,7 @@
actual (!.use (\ file content) [])
logging! (\ ///action.monad map
- (text\= //clean.success)
+ (text\= /.success)
(!.use (\ console read_line) []))
#let [expected_path!
@@ -65,7 +65,7 @@
(wrap (and logging!
expected_path!
expected_content!)))]
- (_.cover' [/.do!]
+ (_.cover' [/.do! /.success]
(try.default false verdict)))
(#try.Failure error)
diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux
index 6b7ba9324..291b31863 100644
--- a/stdlib/source/test/aedifex/command/test.lux
+++ b/stdlib/source/test/aedifex/command/test.lux
@@ -51,7 +51,7 @@
#let [empty_profile (: Profile
(\ ///.monoid identity))
with_target (: (-> Profile Profile)
- (set@ #///.target (#.Some target)))
+ (set@ #///.target target))
with_test (: (-> Profile Profile)
(set@ #///.test (#.Some test)))
diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux
index 960a75f21..132c51b38 100644
--- a/stdlib/source/test/aedifex/package.lux
+++ b/stdlib/source/test/aedifex/package.lux
@@ -2,13 +2,21 @@
[lux #*
["_" test (#+ Test)]
[abstract
- [monad (#+ do)]]
+ [monad (#+ do)]
+ {[0 #spec]
+ [/
+ ["$." equivalence]]}]
[control
["." try]
[concurrency
[promise (#+ Promise)]]]
[data
- ["." text]
+ ["." product]
+ ["." text
+ [encoding
+ ["." utf8]]]
+ [format
+ ["." xml (#+ XML)]]
[collection
["." set (#+ Set)]]]
[math
@@ -27,9 +35,11 @@
["." /
["/#" // #_
["#" profile]
- ["#." dependency (#+ Dependency)]
["#." pom]
- ["#." hash]]]})
+ [dependency
+ ["#." status]]
+ [repository
+ ["#." origin]]]]})
(def: #export random
(Random [//.Profile /.Package])
@@ -51,15 +61,37 @@
(do {! random.monad}
[[profile package] ..random]
($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence (\ ! map product.right ..random)))
+
+ (_.cover [/.local?]
+ (/.local? (set@ #/.origin (#//origin.Local "~/yolo") package)))
+ (_.cover [/.remote?]
+ (/.remote? (set@ #/.origin (#//origin.Remote "https://example.com") package)))
(_.cover [/.local]
- false
- ## (and (\ //hash.equivalence =
- ## (//hash.sha-1 (get@ #/.library package))
- ## (get@ #/.sha-1 package))
- ## (\ //hash.equivalence =
- ## (//hash.md5 (get@ #/.library package))
- ## (get@ #/.md5 package)))
- )
+ (let [expected_pom (|> package (get@ #/.pom) product.left)
+ expected_library (|> package (get@ #/.library) product.left)
+
+ local (/.local expected_pom expected_library)
+
+ [actual_pom binary_pom pom_status] (get@ #/.pom local)
+ [actual_library library_status] (get@ #/.library local)]
+ (and (case (get@ #/.origin local)
+ (#//origin.Local "") true
+ _ false)
+ (and (is? expected_library actual_library)
+ (case library_status
+ #//status.Unverified true
+ _ false))
+ (and (is? expected_pom actual_pom)
+ (|> (do try.monad
+ [xml_pom (\ utf8.codec decode binary_pom)
+ decoded_pom (\ xml.codec decode xml_pom)]
+ (wrap (\ xml.equivalence = actual_pom decoded_pom)))
+ (try.default false))
+ (case pom_status
+ #//status.Unverified true
+ _ false)))))
(_.cover [/.dependencies]
(let [expected (get@ #//.dependencies profile)]
(case (/.dependencies package)
@@ -68,4 +100,12 @@
(#try.Failure error)
false)))
+ (_.cover [/.repositories]
+ (let [expected (get@ #//.repositories profile)]
+ (case (/.repositories package)
+ (#try.Success actual)
+ (\ set.equivalence = expected actual)
+
+ (#try.Failure error)
+ false)))
))))
diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux
index ea03a1e92..3410255f5 100644
--- a/stdlib/source/test/aedifex/profile.lux
+++ b/stdlib/source/test/aedifex/profile.lux
@@ -125,7 +125,7 @@
(..set_of text.hash ..repository)
(..set_of //dependency.hash @dependency.random)
(..set_of text.hash ..source)
- (random.maybe ..target)
+ ..target
(random.maybe (random.ascii/alpha 1))
(random.maybe (random.ascii/alpha 1))
(..dictionary_of text.hash (random.ascii/alpha 1) ..repository)