aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex
diff options
context:
space:
mode:
authorEduardo Julian2020-11-28 21:40:29 -0400
committerEduardo Julian2020-11-28 21:40:29 -0400
commit7444deb1b80d469280fcb0684d91c13f752a86d6 (patch)
tree132f8aa480dad400c20971f5e085876da8772b75 /stdlib/source/test/aedifex
parenta02b7bf8ff358ccfa35b03272d28537aeac723ae (diff)
Re-named "_.claim" to "_.cover'".
Diffstat (limited to 'stdlib/source/test/aedifex')
-rw-r--r--stdlib/source/test/aedifex/cache.lux36
-rw-r--r--stdlib/source/test/aedifex/command/build.lux61
-rw-r--r--stdlib/source/test/aedifex/command/clean.lux4
-rw-r--r--stdlib/source/test/aedifex/command/deploy.lux4
-rw-r--r--stdlib/source/test/aedifex/command/deps.lux4
-rw-r--r--stdlib/source/test/aedifex/command/install.lux16
-rw-r--r--stdlib/source/test/aedifex/command/pom.lux16
-rw-r--r--stdlib/source/test/aedifex/command/test.lux94
-rw-r--r--stdlib/source/test/aedifex/dependency/resolution.lux76
-rw-r--r--stdlib/source/test/aedifex/input.lux4
10 files changed, 199 insertions, 116 deletions
diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux
index 7dff44202..81d5fe136 100644
--- a/stdlib/source/test/aedifex/cache.lux
+++ b/stdlib/source/test/aedifex/cache.lux
@@ -101,14 +101,14 @@
(wrap (do promise.monad
[wrote! (/.write-one fs dependency expected-package)
read! (/.read-one fs dependency)]
- (_.claim [/.write-one /.read-one]
- (<| (try.default false)
- (do try.monad
- [_ wrote!
- actual-package read!]
- (wrap (:: //package.equivalence =
- (set@ #//package.origin #//package.Local expected-package)
- actual-package)))))))))
+ (_.cover' [/.write-one /.read-one]
+ (<| (try.default false)
+ (do try.monad
+ [_ wrote!
+ actual-package read!]
+ (wrap (:: //package.equivalence =
+ (set@ #//package.origin #//package.Local expected-package)
+ actual-package)))))))))
(def: plural
Test
@@ -119,16 +119,16 @@
(wrap (do promise.monad
[wrote! (/.write-all fs expected)
read! (/.read-all fs (dictionary.keys expected) //dependency/resolution.empty)]
- (_.claim [/.write-all /.read-all]
- (<| (try.default false)
- (do try.monad
- [_ wrote!
- actual read!]
- (wrap (:: //dependency/resolution.equivalence =
- (:: dictionary.functor map
- (set@ #//package.origin #//package.Local)
- expected)
- actual)))))))))
+ (_.cover' [/.write-all /.read-all]
+ (<| (try.default false)
+ (do try.monad
+ [_ wrote!
+ actual read!]
+ (wrap (:: //dependency/resolution.equivalence =
+ (:: dictionary.functor map
+ (set@ #//package.origin #//package.Local)
+ expected)
+ actual)))))))))
(def: #export test
Test
diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux
index 5285b7548..ad72b47c4 100644
--- a/stdlib/source/test/aedifex/command/build.lux
+++ b/stdlib/source/test/aedifex/command/build.lux
@@ -2,8 +2,7 @@
[lux #*
["_" test (#+ Test)]
[abstract
- [monad (#+ do)]
- ["." predicate]]
+ [monad (#+ do)]]
[control
["." try]
["." exception]
@@ -12,30 +11,20 @@
[parser
["." environment]]]
[data
- [text
- ["%" format (#+ format)]]
[collection
- ["." dictionary]
- ["." set]]]
+ ["." dictionary]]]
[math
- ["." random (#+ Random)]]
+ ["." random]]
[world
["." file]
["." shell]]]
["$." /// #_
- ["#." package]
- ["#." artifact]
- ["#." dependency #_
- ["#/." resolution]]]
+ ["#." package]]
{#program
["." /
["//#" /// #_
["#" profile (#+ Profile)]
["#." action]
- ["#." pom]
- ["#." package]
- ["#." cache]
- ["#." repository]
["#." artifact
["#/." type]]
["#." dependency
@@ -96,32 +85,32 @@
(wrap (do promise.monad
[outcome (/.do! environment fs shell ///dependency/resolution.empty
(with-target empty-profile))]
- (_.claim [/.no-specified-program]
- (case outcome
- (#try.Success _)
- false
+ (_.cover' [/.no-specified-program]
+ (case outcome
+ (#try.Success _)
+ false
- (#try.Failure error)
- (exception.match? /.no-specified-program error)))))
+ (#try.Failure error)
+ (exception.match? /.no-specified-program error)))))
(wrap (do promise.monad
[outcome (/.do! environment fs shell ///dependency/resolution.empty
(with-program empty-profile))]
- (_.claim [/.no-specified-target]
- (case outcome
- (#try.Success _)
- false
+ (_.cover' [/.no-specified-target]
+ (case outcome
+ (#try.Success _)
+ false
- (#try.Failure error)
- (exception.match? /.no-specified-target error)))))
+ (#try.Failure error)
+ (exception.match? /.no-specified-target error)))))
(wrap (do promise.monad
[outcome (/.do! environment fs shell ///dependency/resolution.empty profile)]
- (_.claim [/.Compiler /.no-available-compiler]
- (case outcome
- (#try.Success _)
- false
+ (_.cover' [/.Compiler /.no-available-compiler]
+ (case outcome
+ (#try.Success _)
+ false
- (#try.Failure error)
- (exception.match? /.no-available-compiler error)))))
+ (#try.Failure error)
+ (exception.match? /.no-available-compiler error)))))
(do !
[lux-version (random.ascii/alpha 5)
[_ compiler-package] $///package.random
@@ -141,7 +130,7 @@
(dictionary.put compiler-dependency compiler-package))]
_ (/.do! environment fs shell resolution profile)]
(wrap true))]
- (_.claim [/.do!
- /.lux-group /.jvm-compiler-name /.js-compiler-name]
- (try.default false verdict)))))
+ (_.cover' [/.do!
+ /.lux-group /.jvm-compiler-name /.js-compiler-name]
+ (try.default false verdict)))))
))))
diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux
index ba9431b95..7246d38a7 100644
--- a/stdlib/source/test/aedifex/command/clean.lux
+++ b/stdlib/source/test/aedifex/command/clean.lux
@@ -114,5 +114,5 @@
(not target-exists!/post))
(and sub-exists!/pre
(not sub-exists!/post)))))]
- (_.claim [/.do!]
- (try.default false verdict)))))))
+ (_.cover' [/.do!]
+ (try.default false verdict)))))))
diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux
index b27d3c0a7..52b995f6f 100644
--- a/stdlib/source/test/aedifex/command/deploy.lux
+++ b/stdlib/source/test/aedifex/command/deploy.lux
@@ -125,5 +125,5 @@
deployed-pom!
deployed-sha-1!
deployed-md5!)))]
- (_.claim [/.do!]
- (try.default false verdict)))))))
+ (_.cover' [/.do!]
+ (try.default false verdict)))))))
diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux
index ce85a2206..8c19df87f 100644
--- a/stdlib/source/test/aedifex/command/deps.lux
+++ b/stdlib/source/test/aedifex/command/deps.lux
@@ -84,5 +84,5 @@
(not (set.member? pre depender-artifact)))
(and (dictionary.contains? dependee post)
(dictionary.contains? depender post)))))]
- (_.claim [/.do!]
- (try.default false verdict)))))))
+ (_.cover' [/.do!]
+ (try.default false verdict)))))))
diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux
index bcc6bb039..8982bc941 100644
--- a/stdlib/source/test/aedifex/command/install.lux
+++ b/stdlib/source/test/aedifex/command/install.lux
@@ -86,16 +86,16 @@
(file.file-exists? promise.monad fs pom-path))]
(wrap (and library-exists!
pom-exists!)))]
- (_.claim [/.do!]
- (try.default false verdict)))
+ (_.cover' [/.do!]
+ (try.default false verdict)))
#.None
(do {! promise.monad}
[outcome (..execute! fs sample)]
- (_.claim [/.do!]
- (case outcome
- (#try.Success _)
- false
+ (_.cover' [/.do!]
+ (case outcome
+ (#try.Success _)
+ false
- (#try.Failure error)
- true))))))))
+ (#try.Failure error)
+ true))))))))
diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux
index dc05cced0..169318589 100644
--- a/stdlib/source/test/aedifex/command/pom.lux
+++ b/stdlib/source/test/aedifex/command/pom.lux
@@ -54,14 +54,14 @@
(:: binary.equivalence = expected actual)]]
(wrap (and expected-path!
expected-content!)))]
- (_.claim [/.do!]
- (try.default false verdict)))
+ (_.cover' [/.do!]
+ (try.default false verdict)))
(#try.Failure error)
- (_.claim [/.do!]
- (case (get@ #///.identity sample)
- (#.Some _)
- false
+ (_.cover' [/.do!]
+ (case (get@ #///.identity sample)
+ (#.Some _)
+ false
- #.None
- true))))))))
+ #.None
+ true))))))))
diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux
new file mode 100644
index 000000000..be1a89c83
--- /dev/null
+++ b/stdlib/source/test/aedifex/command/test.lux
@@ -0,0 +1,94 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." try]
+ [concurrency
+ ["." promise]]
+ [parser
+ ["." environment]]]
+ [data
+ [collection
+ ["." dictionary]]]
+ [math
+ ["." random]]
+ [world
+ ["." file]
+ ["." shell]]]
+ ["$." /// #_
+ ["#." package]]
+ {#program
+ ["." /
+ ["/#" // #_
+ ["#." build]
+ ["/#" // #_
+ ["#" profile (#+ Profile)]
+ ["#." action]
+ ["#." artifact
+ ["#/." type]]
+ ["#." dependency
+ ["#/." resolution]]]]]})
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (do {! random.monad}
+ [#let [fs (file.mock (:: file.default separator))
+ shell (shell.mock
+ (function (_ [actual-environment actual-working-directory actual-command actual-arguments])
+ (#try.Success
+ (: (shell.Simulation [])
+ (structure
+ (def: (on-read state)
+ (#try.Failure "on-read"))
+ (def: (on-error state)
+ (#try.Failure "on-error"))
+ (def: (on-write input state)
+ (#try.Failure "on-write"))
+ (def: (on-destroy state)
+ (#try.Failure "on-destroy"))
+ (def: (on-await state)
+ (#try.Success [state shell.normal]))))))
+ [])]
+ program (random.ascii/alpha 5)
+ target (random.ascii/alpha 5)
+ working-directory (random.ascii/alpha 5)
+ #let [empty-profile (: Profile
+ (:: ///.monoid identity))
+ with-target (: (-> Profile Profile)
+ (set@ #///.target (#.Some target)))
+ with-program (: (-> Profile Profile)
+ (set@ #///.program (#.Some program)))
+
+ profile (|> empty-profile
+ with-program
+ with-target)
+
+ no-working-directory environment.empty
+
+ environment (dictionary.put "user.dir" working-directory environment.empty)]]
+ ($_ _.and
+ (do !
+ [lux-version (random.ascii/alpha 5)
+ [_ compiler-package] $///package.random
+ #let [jvm-compiler {#///dependency.artifact {#///artifact.group //build.lux-group
+ #///artifact.name //build.jvm-compiler-name
+ #///artifact.version lux-version}
+ #///dependency.type ///artifact/type.lux-library}
+ js-compiler {#///dependency.artifact {#///artifact.group //build.lux-group
+ #///artifact.name //build.js-compiler-name
+ #///artifact.version lux-version}
+ #///dependency.type ///artifact/type.lux-library}]
+ compiler-dependency (random.either (wrap jvm-compiler)
+ (wrap js-compiler))]
+ (wrap (do promise.monad
+ [verdict (do ///action.monad
+ [#let [resolution (|> ///dependency/resolution.empty
+ (dictionary.put compiler-dependency compiler-package))]
+ _ (/.do! environment fs shell resolution profile)]
+ (wrap true))]
+ (_.cover' [/.do!]
+ (try.default false verdict)))))
+ ))))
diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux
index 0b2fbe2e2..8bd013125 100644
--- a/stdlib/source/test/aedifex/dependency/resolution.lux
+++ b/stdlib/source/test/aedifex/dependency/resolution.lux
@@ -164,28 +164,28 @@
[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))))
+ (_.cover' [/.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)
+ (_.cover' [<exception>]
+ (case actual-package
+ (#try.Failure error)
+ (exception.match? <exception> error)
- (#try.Success _)
- false))))]
+ (#try.Success _)
+ false))))]
[/.sha-1-does-not-match bad-sha-1]
[/.md5-does-not-match bad-md5]
@@ -271,28 +271,28 @@
(///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))))
+ (_.cover' [/.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)
+ (_.cover' [/.cannot-resolve]
+ (case actual-package
+ (#try.Failure error)
+ (exception.match? /.cannot-resolve error)
- (#try.Success _)
- false))))
+ (#try.Success _)
+ false))))
)))
(def: all
@@ -343,15 +343,15 @@
(///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)))
+ (_.cover' [/.all]
+ (case resolution
+ (#try.Success resolution)
+ (and (dictionary.contains? depender resolution)
+ (dictionary.contains? dependee resolution)
+ (not (dictionary.contains? ignored resolution)))
- (#try.Failure error)
- false))))
+ (#try.Failure error)
+ false))))
)))
(def: #export test
diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux
index c7f6a4282..9f85ea5af 100644
--- a/stdlib/source/test/aedifex/input.lux
+++ b/stdlib/source/test/aedifex/input.lux
@@ -57,5 +57,5 @@
(wrap (:: //.equivalence =
(update@ #//.sources ..with-default-source expected)
actual)))]
- (_.claim [/.read]
- (try.default false verdict)))))))
+ (_.cover' [/.read]
+ (try.default false verdict)))))))