From a4b64bf1cdf47160b6b615d2c6493039abfd7a94 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 28 Jul 2022 17:39:01 -0400 Subject: Extracted unit-testing machinery into its own module. --- stdlib/source/test/aedifex/command/auto.lux | 7 +++--- stdlib/source/test/aedifex/command/build.lux | 31 +++++++++++++------------- stdlib/source/test/aedifex/command/clean.lux | 7 +++--- stdlib/source/test/aedifex/command/deploy.lux | 7 +++--- stdlib/source/test/aedifex/command/deps.lux | 7 +++--- stdlib/source/test/aedifex/command/install.lux | 9 ++++---- stdlib/source/test/aedifex/command/pom.lux | 9 ++++---- stdlib/source/test/aedifex/command/test.lux | 11 ++++----- stdlib/source/test/aedifex/command/version.lux | 7 +++--- 9 files changed, 52 insertions(+), 43 deletions(-) (limited to 'stdlib/source/test/aedifex/command') diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index 8cc8177a1..10c249e3e 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -31,7 +30,9 @@ ["[0]" file ["[0]" watch]] [time - ["[0]" instant]]]]] + ["[0]" instant]]] + ["_" test (.only Test) + ["[0]" unit]]]] ["[0]" // ["$[0]" version] ["$[0]" build]] @@ -120,6 +121,6 @@ (at ! each (n.= expected_runs)))] (in {try.#Success (and correct_number_of_runs! no_dangling_process!)})))] - (_.coverage' [/.do!] + (unit.coverage [/.do!] (try.else false verdict)))) )))) diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 7ae2a8c72..81907a9ad 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -22,7 +21,9 @@ [world ["[0]" file] ["[0]" shell (.only Shell)] - ["[0]" program]]]] + ["[0]" program]] + ["_" test (.only Test) + ["[0]" unit]]]] ["[0]" // ["@[0]" version] ["$/[1]" // @@ -162,7 +163,7 @@ (in (do async.monad [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty (with_target empty_profile))] - (_.coverage' [/.no_specified_program] + (unit.coverage [/.no_specified_program] (case outcome {try.#Success _} false @@ -171,7 +172,7 @@ (exception.match? /.no_specified_program error))))) (in (do async.monad [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty profile)] - (_.coverage' [/.Lux /.no_available_lux] + (unit.coverage [/.Lux /.no_available_lux] (case outcome {try.#Success _} false @@ -190,15 +191,15 @@ end (at console read_line [])] (in (and (text#= /.start start) (text#= /.success end))))] - (_.coverage' [/.do! - /.lux_group - /.jvm_lux_name - /.js_lux_name - /.python_lux_name - /.lua_lux_name - /.ruby_lux_name - /.start - /.success] + (unit.coverage [/.do! + /.lux_group + /.jvm_lux_name + /.js_lux_name + /.python_lux_name + /.lua_lux_name + /.ruby_lux_name + /.start + /.success] (try.else false verdict))))) (do ! [.let [console (@version.echo "")] @@ -212,7 +213,7 @@ end (at console read_line [])] (in (and (text#= /.start start) (text#= /.failure end))))] - (_.coverage' [/.failure] + (unit.coverage [/.failure] (try.else false verdict))))) (do ! [expected/0 (random.alphabetic 5) @@ -243,7 +244,7 @@ (text#= expected/1 actual/1) (text#= expected/2 actual/2) end!)))] - (_.coverage' [] + (unit.coverage [] (try.else false verdict)))))] [#0 /.log_output!] diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index f4e220aa1..bbc47ccfe 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only do)]] [control @@ -21,7 +20,9 @@ [number ["n" nat]]] [world - ["[0]" file (.only Path)]]]] + ["[0]" file (.only Path)]] + ["_" test (.only Test) + ["[0]" unit]]]] [// ["@[0]" version] [// @@ -115,5 +116,5 @@ (and sub_exists!/pre (not sub_exists!/post)) (text#= (/.success target_path) logging))))] - (_.coverage' [/.do! /.success] + (unit.coverage [/.do! /.success] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index 6a146cc44..dfa352553 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -32,7 +31,9 @@ [world ["[0]" file] ["[0]" program (.only Program)] - ["[0]" shell]]]] + ["[0]" shell]] + ["_" test (.only Test) + ["[0]" unit]]]] [// ["$[0]" build] ["$[0]" install] @@ -130,5 +131,5 @@ deployed_pom! deployed_sha-1! deployed_md5!)))] - (_.coverage' [/.do! /.success] + (unit.coverage [/.do! /.success] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 4d08505b0..905afb575 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] ["[0]" predicate]] @@ -25,7 +24,9 @@ ["[0]" random (.only Random)]] [world ["[0]" program] - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] ["[0]" // ["@[0]" version] ["$/[1]" // @@ -126,5 +127,5 @@ had_dependee_after! had_depender_after!)))] - (_.coverage' [/.do!] + (unit.coverage [/.do!] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index 3221f640a..930cc17f4 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only do)]] [control @@ -21,7 +20,9 @@ ["[0]" random]] [world ["[0]" file] - ["[0]" program (.only Program)]]]] + ["[0]" program (.only Program)]] + ["_" test (.only Test) + ["[0]" unit]]]] [// ["$[0]" version] [// @@ -91,13 +92,13 @@ (in (and succeeded! library_exists! pom_exists!)))] - (_.coverage' [/.do! /.success] + (unit.coverage [/.do! /.success] (try.else false verdict)))) (in (do [! async.monad] [.let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory))] logging (..execute! program fs (has ///.#identity {.#None} sample))] - (_.coverage' [/.failure] + (unit.coverage [/.failure] (|> logging (try#each (text#= /.failure)) (try.else false))))) diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index 9390cb51b..21deefa0f 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -18,7 +17,9 @@ [math ["[0]" random]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [// ["@[0]" version] [// @@ -57,11 +58,11 @@ (binary#= expected actual)]] (in (and logging! expected_content!)))] - (_.coverage' [/.do! /.success] + (unit.coverage [/.do! /.success] (try.else false verdict))) {try.#Failure error} - (_.coverage' [/.do!] + (unit.coverage [/.do!] (case (the ///.#identity sample) {.#Some _} false diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index d65fbd491..440123f65 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -21,7 +20,9 @@ [world ["[0]" file] ["[0]" shell] - ["[0]" program]]]] + ["[0]" program]] + ["_" test (.only Test) + ["[0]" unit]]]] ["[0]" // ["@[0]" version] ["@[0]" build] @@ -74,8 +75,8 @@ (text#= //build.success build_end)) (and (text#= /.start test_start) (text#= /.success test_end)))))] - (_.coverage' [/.do! - /.start /.success] + (unit.coverage [/.do! + /.start /.success] (try.else false verdict))))) (let [fs (file.mock (at file.default separator)) console (@version.echo "")] @@ -110,6 +111,6 @@ (text#= //build.success build_end)) (and (text#= /.start test_start) (text#= /.failure test_end)))))] - (_.coverage' [/.failure] + (unit.coverage [/.failure] (try.else false verdict))))) )))) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index fa22f379b..1becba8d2 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -20,7 +19,9 @@ [compiler ["[0]" version]]] [world - ["[0]" console (.only Console Mock)]]]] + ["[0]" console (.only Console Mock)]] + ["_" test (.only Test) + ["[0]" unit]]]] [/// ["@[0]" profile]] [\\program @@ -73,5 +74,5 @@ logging (at console read_line [])] (in (text#= (version.format lux_version.latest) logging)))] - (_.coverage' [/.do!] + (unit.coverage [/.do!] (try.else false verdict))))))) -- cgit v1.2.3