aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex
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
parentd89d837de3475b75587a4293e094d755d2cd4626 (diff)
Better error messages when re-using a name when making a definition.
Diffstat (limited to 'stdlib/source/test/aedifex')
-rw-r--r--stdlib/source/test/aedifex/artifact.lux4
-rw-r--r--stdlib/source/test/aedifex/artifact/extension.lux4
-rw-r--r--stdlib/source/test/aedifex/cache.lux16
-rw-r--r--stdlib/source/test/aedifex/cli.lux20
-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
-rw-r--r--stdlib/source/test/aedifex/dependency/resolution.lux371
-rw-r--r--stdlib/source/test/aedifex/input.lux4
-rw-r--r--stdlib/source/test/aedifex/package.lux37
-rw-r--r--stdlib/source/test/aedifex/parser.lux6
-rw-r--r--stdlib/source/test/aedifex/profile.lux8
-rw-r--r--stdlib/source/test/aedifex/project.lux26
15 files changed, 536 insertions, 70 deletions
diff --git a/stdlib/source/test/aedifex/artifact.lux b/stdlib/source/test/aedifex/artifact.lux
index 9a4607306..94fd9a5f0 100644
--- a/stdlib/source/test/aedifex/artifact.lux
+++ b/stdlib/source/test/aedifex/artifact.lux
@@ -11,7 +11,7 @@
[concurrency
[promise (#+ Promise)]]]
[data
- ["." text ("#@." equivalence)]]
+ ["." text ("#\." equivalence)]]
[math
["." random (#+ Random)]]
[world
@@ -47,7 +47,7 @@
(_.cover [/.uri /.path]
(|> (/.path fs sample)
(text.replace-all uri.separator (:: fs separator))
- (text@= (/.uri sample)))))
+ (text\= (/.uri sample)))))
/type.test
/extension.test
diff --git a/stdlib/source/test/aedifex/artifact/extension.lux b/stdlib/source/test/aedifex/artifact/extension.lux
index c3da8465c..e098b0f9c 100644
--- a/stdlib/source/test/aedifex/artifact/extension.lux
+++ b/stdlib/source/test/aedifex/artifact/extension.lux
@@ -4,7 +4,7 @@
[abstract
[monad (#+ do)]]
[data
- ["." text ("#@." equivalence)]
+ ["." text ("#\." equivalence)]
[number
["n" nat]]
[collection
@@ -30,7 +30,7 @@
(set.size uniques))))
(_.cover [/.extension]
(`` (and (~~ (template [<type> <extension>]
- [(text@= <extension>
+ [(text\= <extension>
(/.extension <type>))]
[//.lux-library /.lux-library]
diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux
index e1b4abfc5..7dff44202 100644
--- a/stdlib/source/test/aedifex/cache.lux
+++ b/stdlib/source/test/aedifex/cache.lux
@@ -18,7 +18,7 @@
["." set]
["." dictionary]]]
[math
- ["." random (#+ Random) ("#@." monad)]]
+ ["." random (#+ Random) ("#\." monad)]]
[world
["." file]]]
[//
@@ -42,8 +42,8 @@
(def: type
(Random Type)
($_ random.either
- (random@wrap //artifact/type.lux-library)
- (random@wrap //artifact/type.jvm-library)))
+ (random\wrap //artifact/type.lux-library)
+ (random\wrap //artifact/type.jvm-library)))
(def: profile
(Random [Artifact Profile XML])
@@ -69,7 +69,7 @@
content ..content]
(wrap [{#//dependency.artifact identity
#//dependency.type type}
- (//package.local pom content)])))
+ (set@ #//package.origin #//package.Remote (//package.local pom content))])))
(def: resolution
(Random Resolution)
@@ -89,7 +89,7 @@
..profile)
content ..content]
(wrap [dependency
- (//package.local pom content)])))))]
+ (set@ #//package.origin #//package.Remote (//package.local pom content))])))))]
(wrap (dictionary.from-list //dependency.hash (list& [main-dependency main-package] dependencies)))))
(def: singular
@@ -107,7 +107,7 @@
[_ wrote!
actual-package read!]
(wrap (:: //package.equivalence =
- expected-package
+ (set@ #//package.origin #//package.Local expected-package)
actual-package)))))))))
(def: plural
@@ -125,7 +125,9 @@
[_ wrote!
actual read!]
(wrap (:: //dependency/resolution.equivalence =
- expected
+ (:: dictionary.functor map
+ (set@ #//package.origin #//package.Local)
+ expected)
actual)))))))))
(def: #export test
diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux
index b7be4e8bf..5dacd4f16 100644
--- a/stdlib/source/test/aedifex/cli.lux
+++ b/stdlib/source/test/aedifex/cli.lux
@@ -12,9 +12,9 @@
[parser
["." cli]]]
[data
- ["." text ("#@." equivalence)]]
+ ["." text ("#\." equivalence)]]
[math
- ["." random (#+ Random) ("#@." monad)]]]
+ ["." random (#+ Random) ("#\." monad)]]]
{#program
["." /
["/#" // #_
@@ -23,20 +23,20 @@
(def: compilation
(Random /.Compilation)
- (random.or (random@wrap [])
- (random@wrap [])))
+ (random.or (random\wrap [])
+ (random\wrap [])))
(def: command
(Random /.Command)
($_ random.or
## #Clean
- (random@wrap [])
+ (random\wrap [])
## #POM
- (random@wrap [])
+ (random\wrap [])
## #Dependencies
- (random@wrap [])
+ (random\wrap [])
## #Install
- (random@wrap [])
+ (random\wrap [])
## #Deploy
($_ random.and
(random.ascii/alpha 1)
@@ -73,7 +73,7 @@
..format
(cli.run /.command)
(case> (#try.Success [name actual])
- (and (text@= //.default name)
+ (and (text\= //.default name)
(:: /.equivalence = expected actual))
(#try.Failure error)
@@ -90,7 +90,7 @@
(list& "with" expected-profile)
(cli.run /.command)
(case> (#try.Success [actual-profile actual-command])
- (and (text@= expected-profile actual-profile)
+ (and (text\= expected-profile actual-profile)
(:: /.equivalence = expected-command actual-command))
(#try.Failure error)
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)]]
diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux
new file mode 100644
index 000000000..0b2fbe2e2
--- /dev/null
+++ b/stdlib/source/test/aedifex/dependency/resolution.lux
@@ -0,0 +1,371 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]
+ ["." predicate]
+ {[0 #spec]
+ [/
+ ["$." equivalence]]}]
+ [control
+ ["." try]
+ ["." exception]
+ [concurrency
+ ["." promise]]]
+ [data
+ ["." product]
+ ["." binary]
+ ["." text ("#\." equivalence)
+ ["." encoding]]
+ [format
+ ["." xml]]
+ [collection
+ ["." dictionary]
+ ["." set]]]
+ [math
+ ["." random (#+ Random)]]]
+ ["$." /// #_
+ ["#." package]
+ ["#." repository]
+ ["#." artifact]
+ [//
+ [lux
+ [data
+ ["$." binary]]]]]
+ {#program
+ ["." /
+ ["//#" /// #_
+ ["#" profile]
+ ["#." package (#+ Package)]
+ ["#." hash]
+ ["#." repository (#+ Simulation)]
+ ["#." dependency]
+ ["#." pom]
+ ["#." artifact (#+ Artifact)
+ ["#/." type]
+ ["#/." extension]]]]})
+
+(def: random
+ (Random /.Resolution)
+ (do {! random.monad}
+ [artifact $///artifact.random
+ [_ package] $///package.random]
+ (wrap (dictionary.put {#///dependency.artifact artifact
+ #///dependency.type ///artifact/type.lux-library}
+ package
+ /.empty))))
+
+(def: #export (single artifact package)
+ (-> Artifact Package (Simulation Any))
+ (structure
+ (def: (on-download request extension state)
+ (if (:: ///artifact.equivalence = artifact request)
+ (cond (text\= extension ///artifact/extension.lux-library)
+ (#try.Success [state (get@ #///package.library package)])
+
+ (text\= extension ///artifact/extension.pom)
+ (#try.Success [state (|> package
+ (get@ #///package.pom)
+ (:: xml.codec encode)
+ encoding.to-utf8)])
+
+ (text\= extension ///artifact/extension.sha-1)
+ (#try.Success [state (|> package
+ (get@ #///package.sha-1)
+ (:: ///hash.sha-1-codec encode)
+ encoding.to-utf8)])
+
+ (text\= extension ///artifact/extension.md5)
+ (#try.Success [state (|> package
+ (get@ #///package.md5)
+ (:: ///hash.md5-codec encode)
+ encoding.to-utf8)])
+
+ ## else
+ (#try.Failure "NOPE"))
+ (#try.Failure "NOPE")))
+ (def: (on-upload identity artifact extension binary state)
+ (#try.Failure "NOPE"))))
+
+(def: one
+ Test
+ (do {! random.monad}
+ [expected-artifact $///artifact.random
+ [_ expected-package] $///package.random
+ [_ dummy-package] (random.filter (|>> product.right
+ (set@ #///package.pom (get@ #///package.pom expected-package))
+ (:: ///package.equivalence = expected-package)
+ not)
+ $///package.random)
+ #let [good (..single expected-artifact expected-package)
+ bad-sha-1 (: (Simulation Any)
+ (structure
+ (def: (on-download actual-artifact extension state)
+ (if (:: ///artifact.equivalence = expected-artifact actual-artifact)
+ (cond (text\= extension ///artifact/extension.lux-library)
+ (#try.Success [state (get@ #///package.library expected-package)])
+
+ (text\= extension ///artifact/extension.pom)
+ (#try.Success [state (|> expected-package
+ (get@ #///package.pom)
+ (:: xml.codec encode)
+ encoding.to-utf8)])
+
+ (text\= extension ///artifact/extension.sha-1)
+ (#try.Success [state (|> dummy-package
+ (get@ #///package.sha-1)
+ (:: ///hash.sha-1-codec encode)
+ encoding.to-utf8)])
+
+ (text\= extension ///artifact/extension.md5)
+ (#try.Success [state (|> expected-package
+ (get@ #///package.md5)
+ (:: ///hash.md5-codec encode)
+ encoding.to-utf8)])
+
+ ## else
+ (#try.Failure "NOPE"))
+ (#try.Failure "NOPE")))
+ (def: (on-upload identity artifact extension binary state)
+ (#try.Failure "NOPE"))))
+ bad-md5 (: (Simulation Any)
+ (structure
+ (def: (on-download actual-artifact extension state)
+ (if (:: ///artifact.equivalence = expected-artifact actual-artifact)
+ (cond (text\= extension ///artifact/extension.lux-library)
+ (#try.Success [state (get@ #///package.library expected-package)])
+
+ (text\= extension ///artifact/extension.pom)
+ (#try.Success [state (|> expected-package
+ (get@ #///package.pom)
+ (:: xml.codec encode)
+ encoding.to-utf8)])
+
+ (text\= extension ///artifact/extension.sha-1)
+ (#try.Success [state (|> expected-package
+ (get@ #///package.sha-1)
+ (:: ///hash.sha-1-codec encode)
+ encoding.to-utf8)])
+
+ (text\= extension ///artifact/extension.md5)
+ (#try.Success [state (|> dummy-package
+ (get@ #///package.md5)
+ (:: ///hash.md5-codec encode)
+ encoding.to-utf8)])
+
+ ## else
+ (#try.Failure "NOPE"))
+ (#try.Failure "NOPE")))
+ (def: (on-upload identity artifact extension binary state)
+ (#try.Failure "NOPE"))))]]
+ (`` ($_ _.and
+ (wrap
+ (do promise.monad
+ [actual-package (/.one (///repository.mock good [])
+ {#///dependency.artifact expected-artifact
+ #///dependency.type ///artifact/type.lux-library})]
+ (_.claim [/.one]
+ (case actual-package
+ (#try.Success actual-package)
+ (:: ///package.equivalence =
+ (set@ #///package.origin #///package.Remote expected-package)
+ actual-package)
+
+ (#try.Failure _)
+ false))))
+ (~~ (template [<exception> <bad>]
+ [(wrap
+ (do promise.monad
+ [actual-package (/.one (///repository.mock <bad> [])
+ {#///dependency.artifact expected-artifact
+ #///dependency.type ///artifact/type.lux-library})]
+ (_.claim [<exception>]
+ (case actual-package
+ (#try.Failure error)
+ (exception.match? <exception> error)
+
+ (#try.Success _)
+ false))))]
+
+ [/.sha-1-does-not-match bad-sha-1]
+ [/.md5-does-not-match bad-md5]
+ ))
+ ))))
+
+(def: any
+ Test
+ (do {! random.monad}
+ [expected-artifact $///artifact.random
+ [_ expected-package] $///package.random
+ [_ dummy-package] (random.filter (|>> product.right
+ (set@ #///package.pom (get@ #///package.pom expected-package))
+ (:: ///package.equivalence = expected-package)
+ not)
+ $///package.random)
+ #let [good (..single expected-artifact expected-package)
+ bad-sha-1 (: (Simulation Any)
+ (structure
+ (def: (on-download actual-artifact extension state)
+ (if (:: ///artifact.equivalence = expected-artifact actual-artifact)
+ (cond (text\= extension ///artifact/extension.lux-library)
+ (#try.Success [state (get@ #///package.library expected-package)])
+
+ (text\= extension ///artifact/extension.pom)
+ (#try.Success [state (|> expected-package
+ (get@ #///package.pom)
+ (:: xml.codec encode)
+ encoding.to-utf8)])
+
+ (text\= extension ///artifact/extension.sha-1)
+ (#try.Success [state (|> dummy-package
+ (get@ #///package.sha-1)
+ (:: ///hash.sha-1-codec encode)
+ encoding.to-utf8)])
+
+ (text\= extension ///artifact/extension.md5)
+ (#try.Success [state (|> expected-package
+ (get@ #///package.md5)
+ (:: ///hash.md5-codec encode)
+ encoding.to-utf8)])
+
+ ## else
+ (#try.Failure "NOPE"))
+ (#try.Failure "NOPE")))
+ (def: (on-upload identity artifact extension binary state)
+ (#try.Failure "NOPE"))))
+ bad-md5 (: (Simulation Any)
+ (structure
+ (def: (on-download actual-artifact extension state)
+ (if (:: ///artifact.equivalence = expected-artifact actual-artifact)
+ (cond (text\= extension ///artifact/extension.lux-library)
+ (#try.Success [state (get@ #///package.library expected-package)])
+
+ (text\= extension ///artifact/extension.pom)
+ (#try.Success [state (|> expected-package
+ (get@ #///package.pom)
+ (:: xml.codec encode)
+ encoding.to-utf8)])
+
+ (text\= extension ///artifact/extension.sha-1)
+ (#try.Success [state (|> expected-package
+ (get@ #///package.sha-1)
+ (:: ///hash.sha-1-codec encode)
+ encoding.to-utf8)])
+
+ (text\= extension ///artifact/extension.md5)
+ (#try.Success [state (|> dummy-package
+ (get@ #///package.md5)
+ (:: ///hash.md5-codec encode)
+ encoding.to-utf8)])
+
+ ## else
+ (#try.Failure "NOPE"))
+ (#try.Failure "NOPE")))
+ (def: (on-upload identity artifact extension binary state)
+ (#try.Failure "NOPE"))))]]
+ ($_ _.and
+ (wrap
+ (do promise.monad
+ [actual-package (/.any (list (///repository.mock bad-sha-1 [])
+ (///repository.mock bad-md5 [])
+ (///repository.mock good []))
+ {#///dependency.artifact expected-artifact
+ #///dependency.type ///artifact/type.lux-library})]
+ (_.claim [/.any]
+ (case actual-package
+ (#try.Success actual-package)
+ (:: ///package.equivalence =
+ (set@ #///package.origin #///package.Remote expected-package)
+ actual-package)
+
+ (#try.Failure _)
+ false))))
+ (wrap
+ (do promise.monad
+ [actual-package (/.any (list (///repository.mock bad-sha-1 [])
+ (///repository.mock bad-md5 []))
+ {#///dependency.artifact expected-artifact
+ #///dependency.type ///artifact/type.lux-library})]
+ (_.claim [/.cannot-resolve]
+ (case actual-package
+ (#try.Failure error)
+ (exception.match? /.cannot-resolve error)
+
+ (#try.Success _)
+ false))))
+ )))
+
+(def: all
+ Test
+ (do {! random.monad}
+ [dependee-artifact $///artifact.random
+ depender-artifact (random.filter (predicate.complement
+ (:: ///artifact.equivalence = dependee-artifact))
+ $///artifact.random)
+ ignored-artifact (random.filter (predicate.complement
+ (predicate.unite (:: ///artifact.equivalence = dependee-artifact)
+ (:: ///artifact.equivalence = depender-artifact)))
+ $///artifact.random)
+
+ [_ dependee-package] $///package.random
+ [_ depender-package] $///package.random
+ [_ ignored-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}
+ ignored {#///dependency.artifact ignored-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)
+ ignored-pom (|> (:: ///.monoid identity)
+ (set@ #///.identity (#.Some ignored-artifact))
+ ///pom.write
+ try.assume)
+
+ dependee-package (set@ #///package.pom dependee-pom dependee-package)
+ depender-package (set@ #///package.pom depender-pom depender-package)
+ ignored-package (set@ #///package.pom ignored-pom ignored-package)]]
+ ($_ _.and
+ (wrap
+ (do promise.monad
+ [resolution (/.all (list (///repository.mock (..single dependee-artifact dependee-package) [])
+ (///repository.mock (..single depender-artifact depender-package) [])
+ (///repository.mock (..single ignored-artifact ignored-package) []))
+ (list depender)
+ /.empty)]
+ (_.claim [/.all]
+ (case resolution
+ (#try.Success resolution)
+ (and (dictionary.contains? depender resolution)
+ (dictionary.contains? dependee resolution)
+ (not (dictionary.contains? ignored resolution)))
+
+ (#try.Failure error)
+ false))))
+ )))
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (_.with-cover [/.Resolution])
+ ($_ _.and
+ (_.with-cover [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+
+ (_.cover [/.empty]
+ (dictionary.empty? /.empty))
+
+ ..one
+ ..any
+ ..all
+ )))
diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux
index b05d0afcb..c25d6fe36 100644
--- a/stdlib/source/test/aedifex/input.lux
+++ b/stdlib/source/test/aedifex/input.lux
@@ -4,14 +4,14 @@
[abstract
[monad (#+ do)]]
[control
- ["." try (#+ Try) ("#@." functor)]
+ ["." try (#+ Try)]
[concurrency
["." promise (#+ Promise)]]
[security
["!" capability]]]
[data
["." binary]
- ["." text ("#@." equivalence)
+ ["." text
["%" format]
["." encoding]]]
[math
diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux
index b85f6ce4a..5400d4953 100644
--- a/stdlib/source/test/aedifex/package.lux
+++ b/stdlib/source/test/aedifex/package.lux
@@ -31,31 +31,36 @@
["#." pom]
["#." hash]]]})
+(def: #export random
+ (Random [//.Profile /.Package])
+ (do {! random.monad}
+ [content-size (:: ! map (n.% 100) random.nat)
+ content (_binary.random content-size)
+ [profile pom] (random.one (function (_ profile)
+ (try.to-maybe
+ (do try.monad
+ [pom (//pom.write profile)]
+ (wrap [profile pom]))))
+ @profile.random)]
+ (wrap [profile (/.local pom content)])))
+
(def: #export test
Test
(<| (_.covering /._)
(_.with-cover [/.Package])
(do {! random.monad}
- [content-size (:: ! map (n.% 100) random.nat)
- content (_binary.random content-size)
- [profile pom] (random.one (function (_ profile)
- (try.to-maybe
- (do try.monad
- [pom (//pom.write profile)]
- (wrap [profile pom]))))
- @profile.random)]
+ [[profile package] ..random]
($_ _.and
(_.cover [/.local]
- (let [package (/.local pom content)]
- (and (:: //hash.equivalence =
- (//hash.sha-1 content)
- (get@ #/.sha-1 package))
- (:: //hash.equivalence =
- (//hash.md5 content)
- (get@ #/.md5 package)))))
+ (and (:: //hash.equivalence =
+ (//hash.sha-1 (get@ #/.library package))
+ (get@ #/.sha-1 package))
+ (:: //hash.equivalence =
+ (//hash.md5 (get@ #/.library package))
+ (get@ #/.md5 package))))
(_.cover [/.dependencies]
(let [expected (get@ #//.dependencies profile)]
- (case (/.dependencies (/.local pom content))
+ (case (/.dependencies package)
(#try.Success actual)
(:: set.equivalence = expected actual)
diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux
index 12fa349bb..394f93977 100644
--- a/stdlib/source/test/aedifex/parser.lux
+++ b/stdlib/source/test/aedifex/parser.lux
@@ -16,9 +16,9 @@
[collection
["." set (#+ Set)]
["." dictionary (#+ Dictionary)]
- ["." list ("#@." functor)]]]
+ ["." list ("#\." functor)]]]
[math
- ["." random (#+ Random) ("#@." monad)]]
+ ["." random (#+ Random)]]
[macro
["." code]]]
[//
@@ -98,7 +98,7 @@
(|> expected
..with-empty-profile
dictionary.entries
- (list@map (function (_ [name profile])
+ (list\map (function (_ [name profile])
[name (..with-default-sources profile)]))
(dictionary.from-list text.hash)
(:: //project.equivalence = actual))
diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux
index 10d921f94..b49bd7f36 100644
--- a/stdlib/source/test/aedifex/profile.lux
+++ b/stdlib/source/test/aedifex/profile.lux
@@ -14,14 +14,14 @@
[parser
["." cli]]]
[data
- ["." text ("#@." equivalence)]
+ ["." text]
[number
["n" nat]]
[collection
["." set (#+ Set)]
["." dictionary (#+ Dictionary)]]]
[math
- ["." random (#+ Random) ("#@." monad)]]]
+ ["." random (#+ Random) ("#\." monad)]]]
[//
["@." artifact]
["@." dependency]]
@@ -34,8 +34,8 @@
(def: distribution
(Random /.Distribution)
- (random.or (random@wrap [])
- (random@wrap [])))
+ (random.or (random\wrap [])
+ (random\wrap [])))
(def: license
(Random /.License)
diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux
index f2c2917a2..ab8cc438f 100644
--- a/stdlib/source/test/aedifex/project.lux
+++ b/stdlib/source/test/aedifex/project.lux
@@ -8,15 +8,15 @@
["$." equivalence]
["$." monoid]]}]
[control
- ["." try ("#@." functor)]
+ ["." try ("#\." functor)]
["." exception]]
[data
["." product]
- ["." text ("#@." equivalence)]
+ ["." text ("#\." equivalence)]
[number
["n" nat]]]
[math
- ["." random (#+ Random) ("#@." monad)]]]
+ ["." random (#+ Random) ("#\." monad)]]]
[//
["@." profile]]
{#program
@@ -27,7 +27,7 @@
(def: profile
(Random [//.Name //.Profile])
(|> @profile.random
- (random@map (set@ #//.parents (list)))
+ (random\map (set@ #//.parents (list)))
(random.and (random.ascii/alpha 1))))
(def: #export random
@@ -48,16 +48,16 @@
(do random.monad
[[super-name super-profile] ..profile
- [dummy-name dummy-profile] (random.filter (|>> product.left (text@= super-name) not)
+ [dummy-name dummy-profile] (random.filter (|>> product.left (text\= super-name) not)
..profile)
[sub-name sub-profile] (random.filter (function (_ [name profile])
- (and (not (text@= super-name name))
- (not (text@= dummy-name name))))
+ (and (not (text\= super-name name))
+ (not (text\= dummy-name name))))
..profile)
fake-name (random.filter (function (_ name)
- (and (not (text@= super-name name))
- (not (text@= dummy-name name))
- (not (text@= sub-name name))))
+ (and (not (text\= super-name name))
+ (not (text\= dummy-name name))
+ (not (text\= sub-name name))))
(random.ascii/alpha 1))
#let [project ($_ (:: /.monoid compose)
(/.project super-name super-profile)
@@ -70,13 +70,13 @@
($_ _.and
(_.cover [/.profile]
(and (|> (/.profile super-name project)
- (try@map (:: //.equivalence = super-profile))
+ (try\map (:: //.equivalence = super-profile))
(try.default false))
(|> (/.profile dummy-name project)
- (try@map (:: //.equivalence = dummy-profile))
+ (try\map (:: //.equivalence = dummy-profile))
(try.default false))
(|> (/.profile sub-name project)
- (try@map (:: //.equivalence = (:: //.monoid compose sub-profile super-profile)))
+ (try\map (:: //.equivalence = (:: //.monoid compose sub-profile super-profile)))
(try.default false))))
(_.cover [/.unknown-profile]
(case (/.profile fake-name project)