From 7444deb1b80d469280fcb0684d91c13f752a86d6 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 28 Nov 2020 21:40:29 -0400 Subject: Re-named "_.claim" to "_.cover'". --- stdlib/source/test/aedifex/command/build.lux | 61 +++++++---------- stdlib/source/test/aedifex/command/clean.lux | 4 +- stdlib/source/test/aedifex/command/deploy.lux | 4 +- stdlib/source/test/aedifex/command/deps.lux | 4 +- stdlib/source/test/aedifex/command/install.lux | 16 ++--- stdlib/source/test/aedifex/command/pom.lux | 16 ++--- stdlib/source/test/aedifex/command/test.lux | 94 ++++++++++++++++++++++++++ 7 files changed, 141 insertions(+), 58 deletions(-) create mode 100644 stdlib/source/test/aedifex/command/test.lux (limited to 'stdlib/source/test/aedifex/command') 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))))) + )))) -- cgit v1.2.3