diff options
author | Eduardo Julian | 2022-07-28 17:39:01 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-07-28 17:39:01 -0400 |
commit | a4b64bf1cdf47160b6b615d2c6493039abfd7a94 (patch) | |
tree | 3fe8c149d9cad89bbf067c736d196260203d1a01 /stdlib/source/test | |
parent | a4847190df926d35f7ece97da50a2a8b1462a24f (diff) |
Extracted unit-testing machinery into its own module.
Diffstat (limited to 'stdlib/source/test')
51 files changed, 445 insertions, 409 deletions
diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 515ca42b7..9dbb8405b 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except Type) - ["_" test (.only Test)] [abstract ["[0]" monad (.only do)]] [control @@ -25,7 +24,9 @@ ["n" nat]]] [world ["[0]" file] - ["[0]" program]]]] + ["[0]" program]] + ["_" test (.only Test) + ["[0]" unit]]]] [// ["@[0]" profile] ["@[0]" artifact] @@ -111,7 +112,7 @@ (in (do async.monad [wrote! (/.write_one program fs dependency expected_package) read! (/.read_one program fs dependency)] - (_.coverage' [/.write_one /.read_one] + (unit.coverage [/.write_one /.read_one] (<| (try.else false) (do try.monad [_ wrote! @@ -132,7 +133,7 @@ (in (do async.monad [wrote! (/.write_all program fs expected) read! (/.read_all program fs (dictionary.keys expected) //dependency/resolution.empty)] - (_.coverage' [/.write_all /.read_all] + (unit.coverage [/.write_all /.read_all] (<| (try.else false) (do try.monad [_ wrote! diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index d0aef0468..b83d643b8 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -72,7 +72,7 @@ Test (do random.monad [expected ..command] - (_.property "Without profile." + (_.test "Without profile." (|> expected ..format (cli.result /.command) @@ -89,7 +89,7 @@ (do random.monad [expected_profile (random.alphabetic 1) expected_command ..command] - (_.property "With profile." + (_.test "With profile." (|> expected_command ..format (list.partial "with" expected_profile) 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' [<log!>] + (unit.coverage [<log!>] (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))))))) diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index fee8caf9d..2eeb0abb8 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] ["[0]" hash (.only Hash)]] @@ -31,7 +30,9 @@ ["[0]" http ["[1]" client] ["[1]/[0]" status] - ["@[1]" /]]]]]] + ["@[1]" /]]]] + ["_" test (.only Test) + ["[0]" unit]]]] ["$[0]" // (.only) ["[1]/" // ["[1][0]" package]]] @@ -159,7 +160,7 @@ (in (do async.monad [?outcome (/.one repository dependency package) cache (async.future (atom.read! cache))] - (_.coverage' [/.one] + (unit.coverage [/.one] (|> ?outcome (try#each (verify_one 1 address package cache expected_artifact)) (try.else false)))))) @@ -182,7 +183,7 @@ (in (do async.monad [?outcome (/.all repository resolution) cache (async.future (atom.read! cache))] - (_.coverage' [/.all] + (unit.coverage [/.all] (|> ?outcome (try#each (function (_ actual_artifacts) (let [expected_deployments! diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index e724392a5..153d4b4ac 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except all) - ["_" test (.only Test)] [abstract [monad (.only do)] ["[0]" predicate] @@ -26,7 +25,9 @@ ["[0]" set] ["[0]" list]]] [math - ["[0]" random (.only Random)]]]] + ["[0]" random (.only Random)]] + ["_" test (.only Test) + ["[0]" unit]]]] ["$[0]" /// ["[1][0]" package] ["[1][0]" repository] @@ -262,7 +263,7 @@ [actual_package (/.one (///repository.mock good []) [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] - (_.coverage' [/.one] + (unit.coverage [/.one] (case actual_package {try.#Success actual_package} (at ///package.equivalence = @@ -276,7 +277,7 @@ [actual_package (/.one (///repository.mock <bad> []) [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] - (_.coverage' [<exception>] + (unit.coverage [<exception>] (case actual_package {try.#Failure error} (exception.match? <exception> error) @@ -311,7 +312,7 @@ (///repository.mock good [])) [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] - (_.coverage' [/.any] + (unit.coverage [/.any] (case actual_package {try.#Success actual_package} (at ///package.equivalence = @@ -327,7 +328,7 @@ (///repository.mock bad_md5 [])) [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] - (_.coverage' [/.cannot_resolve] + (unit.coverage [/.cannot_resolve] (case actual_package {try.#Failure error} (exception.match? /.cannot_resolve error) @@ -416,7 +417,7 @@ (///repository.mock ..nope [])) (list depender) /.empty)] - (_.coverage' [/.all] + (unit.coverage [/.all] (and (dictionary.key? resolution depender) (list.any? (///dependency#= depender) successes) diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index 23192f590..b9f8195f6 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.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]" profile]] [\\program @@ -63,5 +64,5 @@ (revised //.#sources ..with_default_source) (revised //.#repositories ..with_default_repository)) actual)))] - (_.coverage' [/.read] + (unit.coverage [/.read] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index ed5b95b3b..1e05fbc3a 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] [\\specification @@ -34,7 +33,9 @@ ["[0]" year] ["[0]" month] ["[0]" instant] - ["[0]" duration]]]]] + ["[0]" duration]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\program ["[0]" / (.only) ["/[1]" // (.only) @@ -105,7 +106,7 @@ (in (do async.monad [wrote? (/.write repository artifact expected) actual (/.read repository artifact)] - (_.coverage' [/.write /.read] + (unit.coverage [/.write /.read] (and (case wrote? {try.#Success _} true {try.#Failure _} false) diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index 773dd262b..983b78d6d 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] [\\specification @@ -34,7 +33,9 @@ ["[0]" year] ["[0]" month] ["[0]" instant (.only Instant)] - ["[0]" duration]]]]] + ["[0]" duration]]] + ["_" test (.only Test) + ["[0]" unit]]]] ["$[0]" /// ["[1][0]" artifact ["[1]/[0]" type] @@ -117,7 +118,7 @@ (in (do async.monad [wrote? (/.write repository artifact expected) actual (/.read repository artifact)] - (_.coverage' [/.write /.read] + (unit.coverage [/.write /.read] (and (case wrote? {try.#Success _} true {try.#Failure _} false) diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux index 8eadfd24c..811a8e4e9 100644 --- a/stdlib/source/test/aedifex/repository/local.lux +++ b/stdlib/source/test/aedifex/repository/local.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -19,7 +18,9 @@ ["[0]" random]] [world ["[0]" file] - ["[0]" program]]]] + ["[0]" program]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\program ["[0]" /]]) @@ -42,7 +43,7 @@ [before_upload (at repo download uri) _ (at repo upload uri expected) actual (at repo download uri)] - (_.coverage' [/.repository] + (unit.coverage [/.repository] (and (case before_upload {try.#Success _} false {try.#Failure _} true) diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index 0ea65a1ca..4a747951f 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -88,7 +88,7 @@ Test (<| (_.covering \\polytypic._) (_.for [\\polytypic.equivalence] - (for @.old (_.property "PLACEHOLDER" true) + (for @.old (_.test "PLACEHOLDER" true) (\\specification.spec ..equivalence ..random))))) (def .public test diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index 438a02394..8953e1d80 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -93,11 +93,11 @@ left_outer ..outer right_outer ..outer] (all _.and - (_.property "The union of an interval to itself yields the same interval." + (_.test "The union of an interval to itself yields the same interval." (/#= some_interval (/.union some_interval some_interval))) - (_.property "The union of 2 inner intervals is another inner interval." + (_.test "The union of 2 inner intervals is another inner interval." (/.inner? (/.union left_inner right_inner))) - (_.property "The union of 2 outer intervals yields an inner interval when their complements don't overlap, and an outer when they do." + (_.test "The union of 2 outer intervals yields an inner interval when their complements don't overlap, and an outer when they do." (if (/.overlaps? (/.complement left_outer) (/.complement right_outer)) (/.outer? (/.union left_outer right_outer)) (/.inner? (/.union left_outer right_outer)))) @@ -114,13 +114,13 @@ left_outer ..outer right_outer ..outer] (all _.and - (_.property "The intersection of an interval to itself yields the same interval." + (_.test "The intersection of an interval to itself yields the same interval." (/#= some_interval (/.intersection some_interval some_interval))) - (_.property "The intersection of 2 inner intervals yields an inner interval when they overlap, and an outer when they don't." + (_.test "The intersection of 2 inner intervals yields an inner interval when they overlap, and an outer when they don't." (if (/.overlaps? left_inner right_inner) (/.inner? (/.intersection left_inner right_inner)) (/.outer? (/.intersection left_inner right_inner)))) - (_.property "The intersection of 2 outer intervals is another outer interval." + (_.test "The intersection of 2 outer intervals is another outer interval." (/.outer? (/.intersection left_outer right_outer))) ))) @@ -129,9 +129,9 @@ (do random.monad [some_interval ..interval] (all _.and - (_.property "The complement of a complement is the same as the original." + (_.test "The complement of a complement is the same as the original." (/#= some_interval (|> some_interval /.complement /.complement))) - (_.property "The complement of an interval does not overlap it." + (_.test "The complement of an interval does not overlap it." (not (/.overlaps? some_interval (/.complement some_interval)))) ))) @@ -199,22 +199,22 @@ _ (undefined)))))] (all _.and - (_.property "Every interval is nested into itself." + (_.test "Every interval is nested into itself." (/.nested? some_interval some_interval)) (let [small_inner (/.between n.enum x1 x2) large_inner (/.between n.enum x0 x3)] - (_.property "Inner intervals can be nested inside one another." + (_.test "Inner intervals can be nested inside one another." (and (/.nested? large_inner small_inner) (not (/.nested? small_inner large_inner))))) (let [small_outer (/.between n.enum x2 x1) large_outer (/.between n.enum x3 x0)] - (_.property "Outer intervals can be nested inside one another." + (_.test "Outer intervals can be nested inside one another." (and (/.nested? small_outer large_outer) (not (/.nested? large_outer small_outer))))) (let [left_inner (/.between n.enum x0 x1) right_inner (/.between n.enum x2 x3) outer (/.between n.enum x0 x3)] - (_.property "Inners can be nested inside outers." + (_.test "Inners can be nested inside outers." (and (/.nested? outer left_inner) (/.nested? outer right_inner)))) ))) @@ -233,17 +233,17 @@ _ (undefined)))))] (all _.and - (_.property "No interval overlaps with itself." + (_.test "No interval overlaps with itself." (not (/.overlaps? some_interval some_interval))) (let [left_inner (/.between n.enum x0 x2) right_inner (/.between n.enum x1 x3)] - (_.property "Inner intervals can overlap one another." + (_.test "Inner intervals can overlap one another." (and (/.overlaps? left_inner right_inner) (/.overlaps? right_inner left_inner)))) (let [left_inner (/.between n.enum x0 x2) right_inner (/.between n.enum x1 x3) outer (/.between n.enum x1 x2)] - (_.property "Inners can overlap outers." + (_.test "Inners can overlap outers." (and (/.overlaps? outer left_inner) (/.overlaps? outer right_inner)))) ))) diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index d3ecb4887..e4f3755c2 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -17,7 +16,9 @@ [math ["[0]" random] [number - ["n" nat]]]]] + ["n" nat]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -101,7 +102,7 @@ (/.poison! actor))) _ (async.delay 100) result (async.future (async.value read))] - (_.coverage' [/.poisoned] + (unit.coverage [/.poisoned] (case result {.#Some error} (exception.match? /.poisoned error) @@ -114,8 +115,8 @@ [actor (/.spawn! /.default 0) sent? (/.mail! ++! actor)] (in (..mailed? sent?))))] - (_.coverage' [/.Behavior /.Mail - /.default /.spawn! /.mail!] + (unit.coverage [/.Behavior /.Mail + /.default /.spawn! /.mail!] sent?))) (in (do async.monad @@ -123,7 +124,7 @@ [counter (/.spawn! /.default 0) _ (/.poison! counter)] (/.mail! ++! counter)))] - (_.coverage' [/.dead] + (unit.coverage [/.dead] (case result {try.#Success outcome} false @@ -141,7 +142,7 @@ alive? (/.alive? actor) obituary (/.obituary' actor)] (in {try.#Success [actor sent? alive? obituary]})))] - (_.coverage' [/.Obituary /.obituary'] + (unit.coverage [/.Obituary /.obituary'] (case result {try.#Success [actor sent? alive? {.#Some [error state (list single_pending_message)]}]} (and (..mailed? sent?) @@ -162,7 +163,7 @@ (in (and (n.= 1 output_1) (n.= 2 output_2) (n.= 3 output_3))))] - (_.coverage' [/.Message /.tell!] + (unit.coverage [/.Message /.tell!] (case result {try.#Success outcome} outcome @@ -196,6 +197,6 @@ (in agent))) _ (/.obituary agent) actual (async.future (atom.read! sink))] - (_.coverage' [/.Stop /.observe! /.obituary] + (unit.coverage [/.Stop /.observe! /.obituary] (at (list.equivalence n.equivalence) = expected (sequence.list actual)))))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 42d938ddd..3cdaf2da4 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] [\\specification @@ -21,7 +20,9 @@ [world [time ["[0]" instant] - ["[0]" duration]]]]] + ["[0]" duration]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -73,22 +74,22 @@ (/.async []))] resolved? (/.future (resolver expected)) actual async] - (_.coverage' [/.Async /.Resolver /.async] + (unit.coverage [/.Async /.Resolver /.async] (and resolved? (n.= expected actual))))) (in (do /.monad [actual (/.resolved expected)] - (_.coverage' [/.resolved] + (unit.coverage [/.resolved] (n.= expected actual)))) (in (do /.monad [actual (/.future (io.io expected))] - (_.coverage' [/.future] + (unit.coverage [/.future] (n.= expected actual)))) (in (do /.monad [pre (/.future instant.now) actual (/.schedule! waiting_time (io.io expected)) post (/.future instant.now)] - (_.coverage' [/.schedule!] + (unit.coverage [/.schedule!] (and (n.= expected actual) (i.>= (.int waiting_time) (duration.millis (instant.span pre post))))))) @@ -96,20 +97,20 @@ [pre (/.future instant.now) _ (/.delay waiting_time) post (/.future instant.now)] - (_.coverage' [/.delay] + (unit.coverage [/.delay] (i.>= (.int waiting_time) (duration.millis (instant.span pre post)))))) (in (do /.monad [[leftA rightA] (/.and (/.future (io.io leftE)) (/.future (io.io rightE)))] - (_.coverage' [/.and] + (unit.coverage [/.and] (n.= (n.+ leftE rightE) (n.+ leftA rightA))))) (in (do /.monad [pre (/.future instant.now) actual (/.after waiting_time expected) post (/.future instant.now)] - (_.coverage' [/.after] + (unit.coverage [/.after] (and (n.= expected actual) (i.>= (.int waiting_time) (duration.millis (instant.span pre post))))))) @@ -118,7 +119,7 @@ (/.after waiting_time dummy)) ?right (/.or (/.after waiting_time dummy) (in rightE))] - (_.coverage' [/.or] + (unit.coverage [/.or] (case [?left ?right] [{.#Left leftA} {.#Right rightA}] (n.= (n.+ leftE rightE) @@ -131,7 +132,7 @@ (/.after waiting_time dummy)) rightA (/.either (/.after waiting_time dummy) (in rightE))] - (_.coverage' [/.either] + (unit.coverage [/.either] (n.= (n.+ leftE rightE) (n.+ leftA rightA))))) (in (do /.monad @@ -139,7 +140,7 @@ .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)] (/.async []))] ?never (/.future (/.value async))] - (_.coverage' [/.value] + (unit.coverage [/.value] (case [?actual ?never] [{.#Some actual} {.#None}] (n.= expected actual) @@ -151,13 +152,13 @@ .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)] (/.async []))] nope (/.future (/.resolved? async))] - (_.coverage' [/.resolved?] + (unit.coverage [/.resolved?] (and yep (not nope))))) (in (do /.monad [?none (/.within 0 (/.after waiting_time dummy)) ?actual (/.within waiting_time (in expected))] - (_.coverage' [/.within] + (unit.coverage [/.within] (case [?none ?actual] [{.#None} {.#Some actual}] (n.= expected actual) @@ -171,6 +172,6 @@ (atom.write! value box)) (/.resolved expected))) actual (/.future (atom.read! box))] - (_.coverage' [/.upon!] + (unit.coverage [/.upon!] (n.= expected actual)))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index 05fd6360c..147b8d2cb 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)] [\\specification @@ -19,7 +18,9 @@ [math ["[0]" random] [number - ["n" nat]]]]] + ["n" nat]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -121,14 +122,14 @@ async.resolved /.of_async /.list)] - (_.coverage' [/.of_async /.list] + (unit.coverage [/.of_async /.list] (list#= (list sample) output)))) (in (do async.monad [output (|> inputs (/.sequential 0) /.list)] - (_.coverage' [/.sequential] + (unit.coverage [/.sequential] (list#= inputs output)))) (in (do async.monad @@ -136,7 +137,7 @@ (/.sequential 0) (/.only n.even?) /.list)] - (_.coverage' [/.only] + (unit.coverage [/.only] (list#= (list.only n.even? inputs) output)))) (in (do [! async.monad] @@ -160,14 +161,14 @@ atom.read! async.future (at ! each sequence.list))] - (_.coverage' [/.Subscriber /.subscribe!] + (unit.coverage [/.Subscriber /.subscribe!] (list#= inputs listened)))) (in (do async.monad [actual (/.mix (function (_ input total) (async.resolved (n.+ input total))) 0 (/.sequential 0 inputs))] - (_.coverage' [/.mix] + (unit.coverage [/.mix] (n.= (list#mix n.+ 0 inputs) actual)))) (in (do async.monad @@ -177,7 +178,7 @@ (async.resolved (n.+ input total))) 0) /.list)] - (_.coverage' [/.mixes] + (unit.coverage [/.mixes] (list#= (list.mixes n.+ 0 inputs) actual)))) (in (do async.monad @@ -187,7 +188,7 @@ (/.sequential 0) (/.distinct n.equivalence) /.list)] - (_.coverage' [/.distinct] + (unit.coverage [/.distinct] (list#= (list distinct/0 distinct/1 distinct/2) actual)))) (do ! @@ -201,12 +202,12 @@ enough_polls! (n.= amount_of_polls (list.size actual))]] - (_.coverage' [/.poll] + (unit.coverage [/.poll] (and correct_values! enough_polls!)))) (in (do [! async.monad] [actual (..take_amount amount_of_polls (/.periodic polling_delay))] - (_.coverage' [/.periodic] + (unit.coverage [/.periodic] (n.= amount_of_polls (list.size actual))))))) (in (do async.monad [.let [max_iterations 10] @@ -218,7 +219,7 @@ current]} {.#None})))) /.list)] - (_.coverage' [/.iterations] + (unit.coverage [/.iterations] (and (n.= max_iterations (list.size actual)) (list#= (list.mixes n.+ sample (list.repeated (-- max_iterations) shift)) actual))))) diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index ac4bd63b3..5254ce02f 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only do)] ["[0]" enum]] @@ -26,7 +25,9 @@ [meta ["@" target] [type - ["[0]" refinement]]]]] + ["[0]" refinement]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]]) @@ -43,7 +44,7 @@ .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad [result (async.within ..delay (/.wait! semaphore))] - (_.coverage' [/.semaphore] + (unit.coverage [/.semaphore] (case result {.#Some _} true @@ -56,7 +57,7 @@ (in (do [! async.monad] [_ (monad.each ! /.wait! (list.repeated initial_open_positions semaphore)) result (async.within ..delay (/.wait! semaphore))] - (_.coverage' [/.wait!] + (unit.coverage [/.wait!] (case result {.#Some _} false @@ -72,7 +73,7 @@ result/0 (async.within ..delay block) open_positions (/.signal! semaphore) result/1 (async.within ..delay block)] - (_.coverage' [/.signal!] + (unit.coverage [/.signal!] (case [result/0 result/1 open_positions] [{.#None} {.#Some _} {try.#Success +0}] true @@ -84,7 +85,7 @@ .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad [outcome (/.signal! semaphore)] - (_.coverage' [/.semaphore_is_maxed_out] + (unit.coverage [/.semaphore_is_maxed_out] (case outcome {try.#Failure error} (exception.match? /.semaphore_is_maxed_out error) @@ -123,7 +124,7 @@ [_ processA _ processB .let [outcome (io.run! (atom.read! resource))]] - (_.coverage' [/.mutex /.synchronize!] + (unit.coverage [/.mutex /.synchronize!] (or (text#= (format expected_As expected_Bs) outcome) (text#= (format expected_Bs expected_As) @@ -171,7 +172,7 @@ (waiter resource barrier id)))) (monad.all !)) .let [outcome (io.run! (atom.read! resource))]] - (_.coverage' [/.barrier /.block!] + (unit.coverage [/.barrier /.block!] (and (text.ends_with? expected_ending outcome) (list.every? (function (_ id) (text.contains? (%.nat id) outcome)) diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux index c5f5ce325..cb6fc3e81 100644 --- a/stdlib/source/test/lux/control/concurrency/stm.lux +++ b/stdlib/source/test/lux/control/concurrency/stm.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only Monad do)] [\\specification @@ -17,7 +16,9 @@ [math ["[0]" random] [number - ["n" nat]]]]] + ["n" nat]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -52,11 +53,11 @@ (in (do async.monad [actual (/.commit! (at /.monad in expected))] - (_.coverage' [/.commit!] + (unit.coverage [/.commit!] (n.= expected actual)))) (in (do async.monad [actual (/.commit! (/.read (/.var expected)))] - (_.coverage' [/.Var /.var /.read] + (unit.coverage [/.Var /.var /.read] (n.= expected actual)))) (in (do async.monad [actual (let [box (/.var dummy)] @@ -68,7 +69,7 @@ [_ (/.write expected box) actual (/.read box)] (in (n.= expected actual)))))] - (_.coverage' [/.write] + (unit.coverage [/.write] (and (n.= expected actual) verdict)))) (in (do async.monad @@ -76,7 +77,7 @@ output (/.commit! (do /.monad [_ (/.update (n.+ expected) box)] (/.read box)))] - (_.coverage' [/.update] + (unit.coverage [/.update] (n.= (n.+ expected dummy) output)))) (in (do async.monad @@ -87,7 +88,7 @@ _ (async.future (at sink close)) _ (/.commit! (/.update (n.* 3) box)) changes (frp.list follower)] - (_.coverage' [/.changes] + (unit.coverage [/.changes] (at (list.equivalence n.equivalence) = (list expected (n.* 2 expected)) changes)))) @@ -97,7 +98,7 @@ (list#each (function (_ _) (/.commit! (/.update ++ var)))) (monad.all !)) cummulative (/.commit! (/.read var))] - (_.coverage' [/.STM] + (unit.coverage [/.STM] (n.= iterations_per_process cummulative))))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/thread.lux b/stdlib/source/test/lux/control/concurrency/thread.lux index da2a9ea37..83a626c4f 100644 --- a/stdlib/source/test/lux/control/concurrency/thread.lux +++ b/stdlib/source/test/lux/control/concurrency/thread.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -14,7 +13,9 @@ [world [time ["[0]" instant (.only Instant)] - ["[0]" duration]]]]] + ["[0]" duration]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -41,7 +42,7 @@ (atom.write! [execution_time expected] box)))) _ (async.delay (n.* 2 delay)) [execution_time actual] (async.future (atom.read! box))] - (_.coverage' [/.schedule!] + (unit.coverage [/.schedule!] (let [expected_delay! (i.>= (.int delay) (duration.millis (instant.span reference_time execution_time))) diff --git a/stdlib/source/test/lux/control/security/capability.lux b/stdlib/source/test/lux/control/security/capability.lux index ecc9d22ba..d02572381 100644 --- a/stdlib/source/test/lux/control/security/capability.lux +++ b/stdlib/source/test/lux/control/security/capability.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -11,7 +10,9 @@ [math ["[0]" random] [number - ["n" nat]]]]] + ["n" nat]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]]) @@ -40,6 +41,6 @@ (in (let [capability (..can_io (function (_ _) (io.io expected)))] (do async.monad [actual (/.use (/.async capability) [])] - (_.coverage' [/.async] + (unit.coverage [/.async] (n.= expected actual))))) ))))) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 3fffb74a1..b64a685a2 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -260,7 +260,7 @@ Test (<| (_.covering \\polytypic._) (_.for [\\polytypic.codec] - (for @.old (_.property "PLACEHOLDER" true) + (for @.old (_.test "PLACEHOLDER" true) ($codec.spec ..equivalence ..codec ..gen_record))))) (def .public random diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index 661222696..7485c1d05 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -72,7 +72,7 @@ (def basics Test - (_.property "Can parse character literals." + (_.test "Can parse character literals." (and (should_pass (/.regex "a") "a") (should_fail (/.regex "a") ".") (should_pass (/.regex "\.") ".") @@ -81,30 +81,30 @@ (def system_character_classes Test (all _.and - (_.property "Can parse anything." + (_.test "Can parse anything." (should_pass (/.regex ".") "a")) - (_.property "Can parse digits." + (_.test "Can parse digits." (and (should_pass (/.regex "\d") "0") (should_fail (/.regex "\d") "m"))) - (_.property "Can parse non digits." + (_.test "Can parse non digits." (and (should_pass (/.regex "\D") "m") (should_fail (/.regex "\D") "0"))) - (_.property "Can parse white-space." + (_.test "Can parse white-space." (and (should_pass (/.regex "\s") " ") (should_fail (/.regex "\s") "m"))) - (_.property "Can parse non white-space." + (_.test "Can parse non white-space." (and (should_pass (/.regex "\S") "m") (should_fail (/.regex "\S") " "))) - (_.property "Can parse word characters." + (_.test "Can parse word characters." (and (should_pass (/.regex "\w") "_") (should_fail (/.regex "\w") "^"))) - (_.property "Can parse non word characters." + (_.test "Can parse non word characters." (and (should_pass (/.regex "\W") ".") (should_fail (/.regex "\W") "a"))) )) @@ -112,46 +112,46 @@ (def special_system_character_classes Test (all _.and - (_.property "Lower-case." + (_.test "Lower-case." (and (should_pass (/.regex "\p{Lower}") "m") (should_fail (/.regex "\p{Lower}") "M"))) - (_.property "Upper-case." + (_.test "Upper-case." (and (should_pass (/.regex "\p{Upper}") "M") (should_fail (/.regex "\p{Upper}") "m"))) - (_.property "Alphabetic." + (_.test "Alphabetic." (and (should_pass (/.regex "\p{Alpha}") "M") (should_fail (/.regex "\p{Alpha}") "0"))) - (_.property "Numeric digits." + (_.test "Numeric digits." (and (should_pass (/.regex "\p{Digit}") "1") (should_fail (/.regex "\p{Digit}") "n"))) - (_.property "Alphanumeric." + (_.test "Alphanumeric." (and (should_pass (/.regex "\p{Alnum}") "1") (should_fail (/.regex "\p{Alnum}") "."))) - (_.property "Whitespace." + (_.test "Whitespace." (and (should_pass (/.regex "\p{Space}") " ") (should_fail (/.regex "\p{Space}") "."))) - (_.property "Hexadecimal." + (_.test "Hexadecimal." (and (should_pass (/.regex "\p{HexDigit}") "a") (should_fail (/.regex "\p{HexDigit}") "."))) - (_.property "Octal." + (_.test "Octal." (and (should_pass (/.regex "\p{OctDigit}") "6") (should_fail (/.regex "\p{OctDigit}") "."))) - (_.property "Blank." + (_.test "Blank." (and (should_pass (/.regex "\p{Blank}") text.tab) (should_fail (/.regex "\p{Blank}") "."))) - (_.property "ASCII." + (_.test "ASCII." (and (should_pass (/.regex "\p{ASCII}") text.tab) (should_fail (/.regex "\p{ASCII}") (text.of_char (hex "1234"))))) - (_.property "Control characters." + (_.test "Control characters." (and (should_pass (/.regex "\p{Contrl}") (text.of_char (hex "12"))) (should_fail (/.regex "\p{Contrl}") "a"))) - (_.property "Punctuation." + (_.test "Punctuation." (and (should_pass (/.regex "\p{Punct}") "@") (should_fail (/.regex "\p{Punct}") "a"))) - (_.property "Graph." + (_.test "Graph." (and (should_pass (/.regex "\p{Graph}") "@") (should_fail (/.regex "\p{Graph}") " "))) - (_.property "Print." + (_.test "Print." (and (should_pass (/.regex "\p{Print}") (text.of_char (hex "20"))) (should_fail (/.regex "\p{Print}") (text.of_char (hex "1234"))))) )) @@ -159,30 +159,30 @@ (def custom_character_classes Test (all _.and - (_.property "Can parse using custom character classes." + (_.test "Can parse using custom character classes." (and (should_pass (/.regex "[abc]") "a") (should_fail (/.regex "[abc]") "m"))) - (_.property "Can parse using character ranges." + (_.test "Can parse using character ranges." (and (should_pass (/.regex "[a-z]") "a") (should_pass (/.regex "[a-z]") "m") (should_pass (/.regex "[a-z]") "z"))) - (_.property "Can combine character ranges." + (_.test "Can combine character ranges." (and (should_pass (/.regex "[a-zA-Z]") "a") (should_pass (/.regex "[a-zA-Z]") "m") (should_pass (/.regex "[a-zA-Z]") "z") (should_pass (/.regex "[a-zA-Z]") "A") (should_pass (/.regex "[a-zA-Z]") "M") (should_pass (/.regex "[a-zA-Z]") "Z"))) - (_.property "Can negate custom character classes." + (_.test "Can negate custom character classes." (and (should_fail (/.regex "[^abc]") "a") (should_pass (/.regex "[^abc]") "m"))) - (_.property "Can negate character ranges.." + (_.test "Can negate character ranges.." (and (should_fail (/.regex "[^a-z]") "a") (should_pass (/.regex "[^a-z]") "0"))) - (_.property "Can parse negate combinations of character ranges." + (_.test "Can parse negate combinations of character ranges." (and (should_fail (/.regex "[^a-zA-Z]") "a") (should_pass (/.regex "[^a-zA-Z]") "0"))) - (_.property "Can make custom character classes more specific." + (_.test "Can make custom character classes more specific." (and (let [RE (/.regex "[a-z&&[def]]")] (and (should_fail RE "a") (should_pass RE "d"))) @@ -198,7 +198,7 @@ (def references Test (let [number (/.regex "\d+")] - (_.property "Can build complex regexs by combining simpler ones." + (_.test "Can build complex regexs by combining simpler ones." (should_check ["809-345-6789" "809" "345" "6789"] (/.regex "(\@<number>)-(\@<number>)-(\@<number>)") "809-345-6789")))) @@ -206,18 +206,18 @@ (def fuzzy_quantifiers Test (all _.and - (_.property "Can sequentially combine patterns." + (_.test "Can sequentially combine patterns." (text_should_pass "aa" (/.regex "aa") "aa")) - (_.property "Can match patterns optionally." + (_.test "Can match patterns optionally." (and (text_should_pass "a" (/.regex "a?") "a") (text_should_pass "" (/.regex "a?") ""))) - (_.property "Can match a pattern 0 or more times." + (_.test "Can match a pattern 0 or more times." (and (text_should_pass "aaa" (/.regex "a*") "aaa") (text_should_pass "" (/.regex "a*") ""))) - (_.property "Can match a pattern 1 or more times." + (_.test "Can match a pattern 1 or more times." (and (text_should_pass "aaa" (/.regex "a+") "aaa") (text_should_pass "a" (/.regex "a+") "a") (should_fail (/.regex "a+") ""))) @@ -226,21 +226,21 @@ (def crisp_quantifiers Test (all _.and - (_.property "Can match a pattern N times." + (_.test "Can match a pattern N times." (and (text_should_pass "aa" (/.regex "a{2}") "aa") (text_should_pass "a" (/.regex "a{1}") "a") (should_fail (/.regex "a{3}") "aa"))) - (_.property "Can match a pattern at-least N times." + (_.test "Can match a pattern at-least N times." (and (text_should_pass "aa" (/.regex "a{1,}") "aa") (text_should_pass "aa" (/.regex "a{2,}") "aa") (should_fail (/.regex "a{3,}") "aa"))) - (_.property "Can match a pattern at-most N times." + (_.test "Can match a pattern at-most N times." (and (text_should_pass "aa" (/.regex "a{,2}") "aa") (text_should_pass "aa" (/.regex "a{,3}") "aa"))) - (_.property "Can match a pattern between N and M times." + (_.test "Can match a pattern between N and M times." (and (text_should_pass "a" (/.regex "a{1,2}") "a") (text_should_pass "aa" (/.regex "a{1,2}") "aa"))) )) @@ -248,7 +248,7 @@ (def groups Test (all _.and - (_.property "Can extract groups of sub-matches specified in a pattern." + (_.test "Can extract groups of sub-matches specified in a pattern." (and (should_check ["abc" "b"] (/.regex "a(.)c") "abc") (should_check ["abbbbbc" "bbbbb"] (/.regex "a(b+)c") "abbbbbc") (should_check ["809-345-6789" "809" "345" "6789"] (/.regex "(\d{3})-(\d{3})-(\d{4})") "809-345-6789") @@ -257,18 +257,18 @@ (should_check ["809-809-6789" "809" "6789"] (/.regex "(?<code>\d{3})-\k<code>-(\d{4})") "809-809-6789") (should_check ["809-809-6789-6789" "809" "6789"] (/.regex "(?<code>\d{3})-\k<code>-(\d{4})-\0") "809-809-6789-6789"))) - (_.property "Can specify groups within groups." + (_.test "Can specify groups within groups." (should_check ["809-345-6789" "809" ["345-6789" "345" "6789"]] (/.regex "(\d{3})-((\d{3})-(\d{4}))") "809-345-6789")) )) (def alternation Test (all _.and - (_.property "Can specify alternative patterns." + (_.test "Can specify alternative patterns." (and (should_check ["a" {0 #0 []}] (/.regex "a|b") "a") (should_check ["b" {0 #1 []}] (/.regex "a|b") "b") (should_fail (/.regex "a|b") "c"))) - (_.property "Can have groups within alternations." + (_.test "Can have groups within alternations." (and (should_check ["abc" {0 #0 ["b" "c"]}] (/.regex "a(.)(.)|b(.)(.)") "abc") (should_check ["bcd" {0 #1 ["c" "d"]}] (/.regex "a(.)(.)|b(.)(.)") "bcd") (should_fail (/.regex "a(.)(.)|b(.)(.)") "cde") diff --git a/stdlib/source/test/lux/ffi.php.lux b/stdlib/source/test/lux/ffi.php.lux index b047e35fa..324bd7b81 100644 --- a/stdlib/source/test/lux/ffi.php.lux +++ b/stdlib/source/test/lux/ffi.php.lux @@ -21,5 +21,5 @@ (do [! random.monad] [] (<| (_.covering /._) - (_.property "TBD" + (_.test "TBD" true)))) diff --git a/stdlib/source/test/lux/ffi.scm.lux b/stdlib/source/test/lux/ffi.scm.lux index b047e35fa..324bd7b81 100644 --- a/stdlib/source/test/lux/ffi.scm.lux +++ b/stdlib/source/test/lux/ffi.scm.lux @@ -21,5 +21,5 @@ (do [! random.monad] [] (<| (_.covering /._) - (_.property "TBD" + (_.test "TBD" true)))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux index ac89471ba..5de7ad7d3 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux @@ -61,11 +61,11 @@ [antiT antiC] (|> ..primitive (r.only (|>> product.left (type#= primT) not)))] (all _.and - (_.property "Can test for reference equality." + (_.test "Can test for reference equality." (check_success+ "lux is" (list primC primC) Bit)) - (_.property "Reference equality must be done with elements of the same type." + (_.test "Reference equality must be done with elements of the same type." (check_failure+ "lux is" (list primC antiC) Bit)) - (_.property "Can 'try' risky IO computations." + (_.test "Can 'try' risky IO computations." (check_success+ "lux try" (list (` ("lux io error" "YOLO"))) (type_literal (Either Text primT)))) @@ -78,23 +78,23 @@ signedC (|> r.int (at ! each code.int)) paramC (|> r.nat (at ! each code.nat))] (all _.and - (_.property "i64 'and'." + (_.test "i64 'and'." (check_success+ "lux i64 and" (list paramC subjectC) Nat)) - (_.property "i64 'or'." + (_.test "i64 'or'." (check_success+ "lux i64 or" (list paramC subjectC) Nat)) - (_.property "i64 'xor'." + (_.test "i64 'xor'." (check_success+ "lux i64 xor" (list paramC subjectC) Nat)) - (_.property "i64 left-shift." + (_.test "i64 left-shift." (check_success+ "lux i64 left-shift" (list paramC subjectC) Nat)) - (_.property "i64 logical-right-shift." + (_.test "i64 logical-right-shift." (check_success+ "lux i64 logical-right-shift" (list paramC subjectC) Nat)) - (_.property "i64 arithmetic-right-shift." + (_.test "i64 arithmetic-right-shift." (check_success+ "lux i64 arithmetic-right-shift" (list paramC signedC) Int)) - (_.property "i64 equivalence." + (_.test "i64 equivalence." (check_success+ "lux i64 =" (list paramC subjectC) Bit)) - (_.property "i64 addition." + (_.test "i64 addition." (check_success+ "lux i64 +" (list paramC subjectC) Int)) - (_.property "i64 subtraction." + (_.test "i64 subtraction." (check_success+ "lux i64 -" (list paramC subjectC) Int)) ))) @@ -104,17 +104,17 @@ [subjectC (|> r.int (at ! each code.int)) paramC (|> r.int (at ! each code.int))] (all _.and - (_.property "Can multiply integers." + (_.test "Can multiply integers." (check_success+ "lux i64 *" (list paramC subjectC) Int)) - (_.property "Can divide integers." + (_.test "Can divide integers." (check_success+ "lux i64 /" (list paramC subjectC) Int)) - (_.property "Can calculate remainder of integers." + (_.test "Can calculate remainder of integers." (check_success+ "lux i64 %" (list paramC subjectC) Int)) - (_.property "Can compare integers." + (_.test "Can compare integers." (check_success+ "lux i64 <" (list paramC subjectC) Bit)) - (_.property "Can convert integer to text." + (_.test "Can convert integer to text." (check_success+ "lux i64 char" (list subjectC) Text)) - (_.property "Can convert integer to fraction." + (_.test "Can convert integer to fraction." (check_success+ "lux i64 f64" (list subjectC) Frac)) ))) @@ -125,31 +125,31 @@ paramC (|> r.safe_frac (at ! each code.frac)) encodedC (|> r.safe_frac (at ! each (|>> %.frac code.text)))] (all _.and - (_.property "Can add frac numbers." + (_.test "Can add frac numbers." (check_success+ "lux f64 +" (list paramC subjectC) Frac)) - (_.property "Can subtract frac numbers." + (_.test "Can subtract frac numbers." (check_success+ "lux f64 -" (list paramC subjectC) Frac)) - (_.property "Can multiply frac numbers." + (_.test "Can multiply frac numbers." (check_success+ "lux f64 *" (list paramC subjectC) Frac)) - (_.property "Can divide frac numbers." + (_.test "Can divide frac numbers." (check_success+ "lux f64 /" (list paramC subjectC) Frac)) - (_.property "Can calculate remainder of frac numbers." + (_.test "Can calculate remainder of frac numbers." (check_success+ "lux f64 %" (list paramC subjectC) Frac)) - (_.property "Can test equivalence of frac numbers." + (_.test "Can test equivalence of frac numbers." (check_success+ "lux f64 =" (list paramC subjectC) Bit)) - (_.property "Can compare frac numbers." + (_.test "Can compare frac numbers." (check_success+ "lux f64 <" (list paramC subjectC) Bit)) - (_.property "Can obtain minimum frac number." + (_.test "Can obtain minimum frac number." (check_success+ "lux f64 min" (list) Frac)) - (_.property "Can obtain maximum frac number." + (_.test "Can obtain maximum frac number." (check_success+ "lux f64 max" (list) Frac)) - (_.property "Can obtain smallest frac number." + (_.test "Can obtain smallest frac number." (check_success+ "lux f64 smallest" (list) Frac)) - (_.property "Can convert frac number to integer." + (_.test "Can convert frac number to integer." (check_success+ "lux f64 i64" (list subjectC) Int)) - (_.property "Can convert frac number to text." + (_.test "Can convert frac number to text." (check_success+ "lux f64 encode" (list subjectC) Text)) - (_.property "Can convert text to frac number." + (_.test "Can convert text to frac number." (check_success+ "lux f64 decode" (list encodedC) (type_literal (Maybe Frac)))) ))) @@ -162,19 +162,19 @@ fromC (|> r.nat (at ! each code.nat)) toC (|> r.nat (at ! each code.nat))] (all _.and - (_.property "Can test text equivalence." + (_.test "Can test text equivalence." (check_success+ "lux text =" (list paramC subjectC) Bit)) - (_.property "Compare texts in lexicographical order." + (_.test "Compare texts in lexicographical order." (check_success+ "lux text <" (list paramC subjectC) Bit)) - (_.property "Can concatenate one text to another." + (_.test "Can concatenate one text to another." (check_success+ "lux text concat" (list subjectC paramC) Text)) - (_.property "Can find the index of a piece of text inside a larger one that (may) contain it." + (_.test "Can find the index of a piece of text inside a larger one that (may) contain it." (check_success+ "lux text index" (list fromC paramC subjectC) (type_literal (Maybe Nat)))) - (_.property "Can query the size/length of a text." + (_.test "Can query the size/length of a text." (check_success+ "lux text size" (list subjectC) Nat)) - (_.property "Can obtain the character code of a text at a given index." + (_.test "Can obtain the character code of a text at a given index." (check_success+ "lux text char" (list fromC subjectC) Nat)) - (_.property "Can clip a piece of text between 2 indices." + (_.test "Can clip a piece of text between 2 indices." (check_success+ "lux text clip" (list fromC toC subjectC) Text)) ))) @@ -184,9 +184,9 @@ [logC (|> (r.unicode 5) (at ! each code.text)) exitC (|> r.int (at ! each code.int))] (all _.and - (_.property "Can log messages to standard output." + (_.test "Can log messages to standard output." (check_success+ "lux io log" (list logC) Any)) - (_.property "Can throw a run-time error." + (_.test "Can throw a run-time error." (check_success+ "lux io error" (list logC) Nothing)) ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux index 07414ac90..62d7d5db2 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/primitive.lux @@ -78,7 +78,7 @@ (,, (with_template [<analysis> <synthesis> <generator>] [(do r.monad [expected <generator>] - (_.property (%.symbol (symbol <synthesis>)) + (_.test (%.symbol (symbol <synthesis>)) (|> {////analysis.#Primitive {<analysis> expected}} (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux index d17044f40..8da9fae17 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/synthesis/structure.lux @@ -44,7 +44,7 @@ (-- tagA) tagA)] memberA //primitive.primitive] - (_.property "Can synthesize variants." + (_.test "Can synthesize variants." (|> (////analysis.variant [lefts right? memberA]) (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) @@ -63,7 +63,7 @@ (do [! r.monad] [size (|> r.nat (at ! each (|>> (n.% 10) (n.max 2)))) membersA (r.list size //primitive.primitive)] - (_.property "Can synthesize tuple." + (_.test "Can synthesize tuple." (|> (////analysis.tuple membersA) (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux index a87bcbd66..fa6f6fade 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/syntax.lux @@ -75,7 +75,7 @@ (do [! r.monad] [sample code^] (all _.and - (_.property "Can parse Lux code." + (_.test "Can parse Lux code." (case (let [source_code (%.code sample)] (/.parse "" (dictionary.empty text.hash) (text.size source_code) [location.dummy 0 source_code])) @@ -86,7 +86,7 @@ (at code.equivalence = parsed sample))) (do ! [other code^] - (_.property "Can parse multiple Lux code nodes." + (_.test "Can parse multiple Lux code nodes." (let [source_code (format (%.code sample) " " (%.code other)) source_code//size (text.size source_code)] (case (/.parse "" (dictionary.empty text.hash) source_code//size @@ -124,7 +124,7 @@ [sample code^ comment comment^] (all _.and - (_.property "Can handle comments." + (_.test "Can handle comments." (case (let [source_code (format comment (%.code sample)) source_code//size (text.size source_code)] (/.parse "" (dictionary.empty text.hash) source_code//size diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache.lux b/stdlib/source/test/lux/meta/compiler/meta/cache.lux index 68ba4e7fb..e52d9f4c2 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -11,7 +10,9 @@ [math ["[0]" random]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]] ["[0]" / @@ -36,7 +37,7 @@ outcome (/.enable! ! fs context) post/0 (at fs directory? (/.path fs context)) post/1 (/.enabled? fs context)] - (_.coverage' [/.path /.enabled? /.enable!] + (unit.coverage [/.path /.enabled? /.enable!] (and (not pre/0) (not pre/1) diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/archive.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/archive.lux index 09821245e..09263a7d3 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/archive.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/archive.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -17,7 +16,9 @@ [number ["n" nat]]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) ["/[1]" // (.only) @@ -72,7 +73,7 @@ cached? (/.cache! fs context archive) actual (at fs read (/.descriptor fs context)) post/0 (at fs file? (/.descriptor fs context))] - (_.coverage' [/.descriptor /.cache!] + (unit.coverage [/.descriptor /.cache!] (and (not pre/0) (|> (do try.monad [_ enabled? diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux index 7d3fa626d..aff81fd7e 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/artifact.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -16,7 +15,9 @@ [number ["n" nat]]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) ["/[1]" // @@ -41,7 +42,7 @@ write! (/.cache! fs context @module @artifact expected) post (at fs file? (/.path fs context @module @artifact)) read! (/.cache fs context @module @artifact)] - (_.coverage' [/.path /.cache! /.cache] + (unit.coverage [/.path /.cache! /.cache] (and (not pre) (case write! {try.#Success _} true diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux index bce9082e5..bf12dcc3a 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/module.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -12,7 +11,9 @@ [math ["[0]" random]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" /]] ["$[0]" /// @@ -60,7 +61,7 @@ outcome (/.enable! ! fs context @module) post/0 (at fs directory? (/.path fs context @module)) post/1 (/.enabled? fs context @module)] - (_.coverage' [/.path /.enabled? /.enable!] + (unit.coverage [/.path /.enabled? /.enable!] (and (not pre/0) (not pre/1) @@ -78,7 +79,7 @@ outcome (/.enable! ! (..bad fs) context @module) post/0 (at fs directory? (/.path fs context @module)) post/1 (/.enabled? fs context @module)] - (_.coverage' [/.cannot_enable] + (unit.coverage [/.cannot_enable] (and (not pre/0) (not pre/1) diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux index c5bc1dfb5..cf0b520f2 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/purge.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -23,7 +22,9 @@ [number ["n" nat]]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) ["/[1]" // @@ -124,7 +125,7 @@ pre (at fs directory_files dir) _ (/.purge! fs context id/0) post (at fs directory_files dir)] - (_.coverage' [/.purge!] + (unit.coverage [/.purge!] (<| (try.else false) (do try.monad [pre pre] diff --git a/stdlib/source/test/lux/meta/compiler/meta/export.lux b/stdlib/source/test/lux/meta/compiler/meta/export.lux index d9fb14ace..e1dd299b0 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/export.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/export.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -27,7 +26,9 @@ [number ["n" nat]]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -73,8 +74,8 @@ export_tar (at fs read (format target / /.file)) export_tar (at ! in (<binary>.result tar.parser export_tar))] (in [library_tar export_tar]))] - (all _.and' - (_.coverage' [/.library /.mode /.ownership] + (all unit.and + (unit.coverage [/.library /.mode /.ownership] (|> it (try#each (|>> product.left sequence.list @@ -97,7 +98,7 @@ _ false))) (try.else false))) - (_.coverage' [/.export /.file] + (unit.coverage [/.export /.file] (|> it (try#each (|>> product.right sequence.list diff --git a/stdlib/source/test/lux/meta/compiler/meta/import.lux b/stdlib/source/test/lux/meta/compiler/meta/import.lux index fc2e79616..30ba445cd 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/import.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/import.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -30,7 +29,9 @@ [number ["n" nat]]] [world - ["[0]" file]]]] + ["[0]" file]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -118,7 +119,7 @@ _ (at fs write library/0 library_content/0) _ (at fs write library/1 library_content/1)] (/.import fs (list library/0 library/1)))] - (_.coverage' [/.import] + (unit.coverage [/.import] (and (|> it/0 (try#each imported?) (try.else false)) @@ -131,7 +132,7 @@ _ (at fs write library/0 library_content) _ (/.import fs (list library/0 library/0))] (in false))] - (_.coverage' [/.duplicate] + (unit.coverage [/.duplicate] (exception.otherwise (exception.match? /.duplicate) it)))) (in (do [! async.monad] [it/0 (do (try.with !) @@ -149,7 +150,7 @@ _ (at fs write library/0 library_content/-2) _ (/.import fs (list library/0))] (in false))] - (_.coverage' [/.useless_tar_entry] + (unit.coverage [/.useless_tar_entry] (and (exception.otherwise (exception.match? /.useless_tar_entry) it/0) (exception.otherwise (exception.match? /.useless_tar_entry) it/1) (exception.otherwise (exception.match? /.useless_tar_entry) it/2))))) diff --git a/stdlib/source/test/lux/meta/macro/context.lux b/stdlib/source/test/lux/meta/macro/context.lux index 52df97710..865d6abe8 100644 --- a/stdlib/source/test/lux/meta/macro/context.lux +++ b/stdlib/source/test/lux/meta/macro/context.lux @@ -8,5 +8,5 @@ (def .public test Test (<| (_.covering /._) - (_.property "TBD" false) + (_.test "TBD" false) )) diff --git a/stdlib/source/test/lux/meta/static.lux b/stdlib/source/test/lux/meta/static.lux index aa67ab7a2..0a0d784a9 100644 --- a/stdlib/source/test/lux/meta/static.lux +++ b/stdlib/source/test/lux/meta/static.lux @@ -23,7 +23,7 @@ (def .public test Test (<| (_.covering /._) - (for @.old (_.property "PLACEHOLDER" true)) + (for @.old (_.test "PLACEHOLDER" true)) (_.for [meta.eval]) (`` (all _.and (,, (with_template [<static> <random> <=> <+> <tag>] diff --git a/stdlib/source/test/lux/meta/symbol.lux b/stdlib/source/test/lux/meta/symbol.lux index 6972cd346..1c54441cc 100644 --- a/stdlib/source/test/lux/meta/symbol.lux +++ b/stdlib/source/test/lux/meta/symbol.lux @@ -50,7 +50,7 @@ ($order.spec /.order (..random sizeM1 sizeS1))) (_.for [/.codec] (_.and ($codec.spec /.equivalence /.codec (..random sizeM1 sizeS1)) - (_.property "Encoding a symbol without a module component results in text equal to the short of the symbol." + (_.test "Encoding a symbol without a module component results in text equal to the short of the symbol." (if (text.empty? module1) (same? short1 (at /.codec encoded symbol1)) true)))) @@ -66,7 +66,7 @@ (_.for [.symbol] (let [(open "/#[0]") /.equivalence] (all _.and - (_.property "Can obtain Symbol from a symbol." + (_.test "Can obtain Symbol from a symbol." (and (/#= [.prelude "yolo"] (.symbol .yolo)) (/#= ["test/lux/meta/symbol" "yolo"] (.symbol ..yolo)) (/#= ["" "yolo"] (.symbol yolo)) diff --git a/stdlib/source/test/lux/meta/target/jvm.lux b/stdlib/source/test/lux/meta/target/jvm.lux index 28fff6e38..b3758f810 100644 --- a/stdlib/source/test/lux/meta/target/jvm.lux +++ b/stdlib/source/test/lux/meta/target/jvm.lux @@ -912,7 +912,7 @@ try.trusted (binary.result /class.format)) loader (/loader.memory (/loader.new_library []))]] - (_.property "PUTSTATIC & PUTFIELD & GETFIELD & GETSTATIC" + (_.test "PUTSTATIC & PUTFIELD & GETFIELD & GETSTATIC" (case (do try.monad [_ (/loader.define class_name bytecode loader) class (io.run! (/loader.load class_name loader)) @@ -1732,7 +1732,7 @@ try.trusted (binary.result /class.format)) loader (/loader.memory (/loader.new_library []))]] - (_.property "Class & interface inheritance" + (_.test "Class & interface inheritance" (case (do try.monad [_ (/loader.define abstract_class abstract_bytecode loader) _ (/loader.define interface_class interface_bytecode loader) diff --git a/stdlib/source/test/lux/meta/type/resource.lux b/stdlib/source/test/lux/meta/type/resource.lux index 65618e66a..0935d0c2e 100644 --- a/stdlib/source/test/lux/meta/type/resource.lux +++ b/stdlib/source/test/lux/meta/type/resource.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only) [indexed (.only do)]]] @@ -22,7 +21,9 @@ ["<[1]>" \\parser]] [macro [syntax (.only syntax)] - ["[0]" expansion]]]]] + ["[0]" expansion]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only Res)]]) @@ -126,7 +127,7 @@ (do (/.monad !) <bindings> (in (format left right))))] - (_.coverage' <coverage> + (unit.coverage <coverage> (text#= (format pre post) outcome))))] diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux index 3e47848dc..956969668 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -20,16 +20,17 @@ [number ["n" nat]]]]] [\\library - ["[0]" /]]) + ["[0]" / (.only) + ["[0]" unit]]]) (def (verify expected_message/0 expected_message/1 successes failures [tally message]) - (-> Text Text Nat Nat [/.Tally Text] Bit) + (-> Text Text Nat Nat [unit.Tally Text] Bit) (and (text.contains? expected_message/0 message) (text.contains? expected_message/1 message) - (n.= successes (the /.#successes tally)) - (n.= failures (the /.#failures tally)))) + (n.= successes (the unit.#successes tally)) + (n.= failures (the unit.#failures tally)))) -(def assertion +(def unit_test /.Test (do [! random.monad] [expected_message/0 (random.lower_case 5) @@ -37,25 +38,25 @@ (random.lower_case 5))] (all /.and (in (do async.monad - [[success_tally success_message] (/.assertion expected_message/0 true) - [failure_tally failure_message] (/.assertion expected_message/0 false)] - (/.coverage' [/.assertion /.Tally] + [[success_tally success_message] (unit.test expected_message/0 true) + [failure_tally failure_message] (unit.test expected_message/0 false)] + (unit.coverage [unit.test unit.Tally] (and (text.ends_with? expected_message/0 success_message) (text.ends_with? expected_message/0 failure_message) - (and (n.= 1 (the /.#successes success_tally)) - (n.= 0 (the /.#failures success_tally))) - (and (n.= 0 (the /.#successes failure_tally)) - (n.= 1 (the /.#failures failure_tally))))))) + (and (n.= 1 (the unit.#successes success_tally)) + (n.= 0 (the unit.#failures success_tally))) + (and (n.= 0 (the unit.#successes failure_tally)) + (n.= 1 (the unit.#failures failure_tally))))))) (in (do async.monad - [tt (/.and' (/.assertion expected_message/0 true) - (/.assertion expected_message/1 true)) - ff (/.and' (/.assertion expected_message/0 false) - (/.assertion expected_message/1 false)) - tf (/.and' (/.assertion expected_message/0 true) - (/.assertion expected_message/1 false)) - ft (/.and' (/.assertion expected_message/0 false) - (/.assertion expected_message/1 true))] - (/.coverage' [/.and'] + [tt (unit.and (unit.test expected_message/0 true) + (unit.test expected_message/1 true)) + ff (unit.and (unit.test expected_message/0 false) + (unit.test expected_message/1 false)) + tf (unit.and (unit.test expected_message/0 true) + (unit.test expected_message/1 false)) + ft (unit.and (unit.test expected_message/0 false) + (unit.test expected_message/1 true))] + (unit.coverage [unit.and] (and (..verify expected_message/0 expected_message/1 2 0 tt) (..verify expected_message/0 expected_message/1 0 2 ff) (..verify expected_message/0 expected_message/1 1 1 tf) @@ -72,49 +73,49 @@ (do ! [sample random.nat .let [wrote? (io.run! (write sample))]] - (/.property "" wrote?))) + (/.test "" wrote?))) post (<| (/.seed seed) (do ! [actual random.nat] (in (do async.monad [expected read] - (/.assertion "" (n.= expected actual))))))] + (unit.test "" (n.= expected actual))))))] (in (do async.monad [[pre_tally pre_message] pre [post_tally post_message] post] - (/.coverage' [/.seed] - (and (and (n.= 1 (the /.#successes pre_tally)) - (n.= 0 (the /.#failures pre_tally))) - (and (n.= 1 (the /.#successes post_tally)) - (n.= 0 (the /.#failures post_tally))))))))) + (unit.coverage [/.seed] + (and (and (n.= 1 (the unit.#successes pre_tally)) + (n.= 0 (the unit.#failures pre_tally))) + (and (n.= 1 (the unit.#successes post_tally)) + (n.= 0 (the unit.#failures post_tally))))))))) (def times /.Test (all /.and (do [! random.monad] - [times_assertion (/.times 0 (/.property "" true))] + [times_unit_test (/.times 0 (/.test "" true))] (in (do async.monad - [[tally error] times_assertion] - (/.coverage' [/.must_try_test_at_least_once] + [[tally error] times_unit_test] + (unit.coverage [/.must_try_test_at_least_once] (and (text.contains? (the exception.#label /.must_try_test_at_least_once) error) - (n.= 0 (the /.#successes tally)) - (n.= 1 (the /.#failures tally))))))) + (n.= 0 (the unit.#successes tally)) + (n.= 1 (the unit.#failures tally))))))) (do [! random.monad] [expected (at ! each (|>> (n.% 10) ++) random.nat) .let [counter (is (Atom Nat) (atom.atom 0))] - times_assertion (<| (/.times expected) + times_unit_test (<| (/.times expected) (do ! [_ (in []) .let [_ (io.run! (atom.update! ++ counter))]] - (/.property "" true)))] + (/.test "" true)))] (in (do async.monad - [[tally error] times_assertion + [[tally error] times_unit_test actual (async.future (atom.read! counter))] - (/.coverage' [/.times] + (unit.coverage [/.times] (and (n.= expected actual) - (n.= 1 (the /.#successes tally)) - (n.= 0 (the /.#failures tally))))))) + (n.= 1 (the unit.#successes tally)) + (n.= 0 (the unit.#failures tally))))))) )) (def in_parallel @@ -124,40 +125,40 @@ [expected (at ! each (|>> (n.% 10) ++) random.nat) .let [counter (is (Atom Nat) (atom.atom 0))] - assertion (<| /.in_parallel + unit_test (<| /.in_parallel (list.repeated expected) (is /.Test) (do ! [_ (in []) .let [_ (io.run! (atom.update! ++ counter))]] - (/.property "" true)))] + (/.test "" true)))] (in (do async.monad - [[tally error] assertion + [[tally error] unit_test actual (async.future (atom.read! counter))] - (/.coverage' [/.in_parallel] + (unit.coverage [/.in_parallel] (and (n.= expected actual) - (n.= expected (the /.#successes tally)) - (n.= 0 (the /.#failures tally))))))) + (n.= expected (the unit.#successes tally)) + (n.= 0 (the unit.#failures tally))))))) (do [! random.monad] [expected (at ! each (|>> (n.% 10) ++) random.nat) .let [counter (is (Atom Nat) (atom.atom 0))] - assertion (<| /.in_parallel + unit_test (<| /.in_parallel (list.repeated expected) (is /.Test) (do ! [_ (in []) .let [_ (undefined) _ (io.run! (atom.update! ++ counter))]] - (/.property "" true)))] + (/.test "" true)))] (in (do async.monad - [[tally error] assertion + [[tally error] unit_test actual (async.future (atom.read! counter))] - (/.coverage' [/.error_during_execution] + (unit.coverage [/.error_during_execution] (let [correct_error! (text.contains? (the exception.#label /.error_during_execution) error) no_complete_run! (n.= 0 actual) - no_successes! (n.= 0 (the /.#successes tally)) - ran_all_tests! (n.= expected (the /.#failures tally))] + no_successes! (n.= 0 (the unit.#successes tally)) + ran_all_tests! (n.= expected (the unit.#failures tally))] (and correct_error! no_complete_run! no_successes! @@ -171,49 +172,49 @@ /.Test (all /.and (do random.monad - [not_covering (/.property "" true) - covering (/.covering .._ (/.property "" true))] + [not_covering (/.test "" true) + covering (/.covering .._ (/.test "" true))] (in (do async.monad [[not_covering _] not_covering [covering _] covering] - (/.coverage' [/.covering] - (and (and (set.empty? (the /.#expected not_covering)) - (set.empty? (the /.#actual not_covering))) - (and (not (set.empty? (the /.#expected covering))) - (set.empty? (the /.#actual covering)))))))) + (unit.coverage [/.covering] + (and (and (set.empty? (the unit.#expected not_covering)) + (set.empty? (the unit.#actual not_covering))) + (and (not (set.empty? (the unit.#expected covering))) + (set.empty? (the unit.#actual covering)))))))) (do random.monad - [not_covering (/.covering .._ (/.property "" true)) + [not_covering (/.covering .._ (/.test "" true)) covering (/.covering .._ (/.coverage [..dummy_target] true))] (in (do async.monad [[not_covering _] not_covering [covering _] covering] - (/.coverage' [/.coverage] - (and (and (not (set.empty? (the /.#expected not_covering))) - (not (set.member? (the /.#actual not_covering) (symbol ..dummy_target)))) - (and (not (set.empty? (the /.#expected covering))) - (set.member? (the /.#actual covering) (symbol ..dummy_target)))))))) + (unit.coverage [/.coverage] + (and (and (not (set.empty? (the unit.#expected not_covering))) + (not (set.member? (the unit.#actual not_covering) (symbol ..dummy_target)))) + (and (not (set.empty? (the unit.#expected covering))) + (set.member? (the unit.#actual covering) (symbol ..dummy_target)))))))) (do random.monad - [not_covering (/.covering .._ (/.property "" true)) - covering (/.covering .._ (in (/.coverage' [..dummy_target] true)))] + [not_covering (/.covering .._ (/.test "" true)) + covering (/.covering .._ (in (unit.coverage [..dummy_target] true)))] (in (do async.monad [[not_covering _] not_covering [covering _] covering] - (/.coverage' [/.coverage'] - (and (and (not (set.empty? (the /.#expected not_covering))) - (not (set.member? (the /.#actual not_covering) (symbol ..dummy_target)))) - (and (not (set.empty? (the /.#expected covering))) - (set.member? (the /.#actual covering) (symbol ..dummy_target)))))))) + (unit.coverage [unit.coverage] + (and (and (not (set.empty? (the unit.#expected not_covering))) + (not (set.member? (the unit.#actual not_covering) (symbol ..dummy_target)))) + (and (not (set.empty? (the unit.#expected covering))) + (set.member? (the unit.#actual covering) (symbol ..dummy_target)))))))) (do random.monad - [not_covering (/.covering .._ (/.property "" true)) - covering (/.covering .._ (/.for [..dummy_target] (/.property "" true)))] + [not_covering (/.covering .._ (/.test "" true)) + covering (/.covering .._ (/.for [..dummy_target] (/.test "" true)))] (in (do async.monad [[not_covering _] not_covering [covering _] covering] - (/.coverage' [/.for] - (and (and (not (set.empty? (the /.#expected not_covering))) - (not (set.member? (the /.#actual not_covering) (symbol ..dummy_target)))) - (and (not (set.empty? (the /.#expected covering))) - (set.member? (the /.#actual covering) (symbol ..dummy_target)))))))) + (unit.coverage [/.for] + (and (and (not (set.empty? (the unit.#expected not_covering))) + (not (set.member? (the unit.#actual not_covering) (symbol ..dummy_target)))) + (and (not (set.empty? (the unit.#expected covering))) + (set.member? (the unit.#actual covering) (symbol ..dummy_target)))))))) )) (def .public test @@ -227,78 +228,78 @@ expected_message/1 (random.only (|>> (text#= expected_message/0) not) (random.lower_case 5))] (all /.and - (/.for [/.Assertion] - ..assertion) + (/.for [unit.Test] + ..unit_test) (/.for [/.Seed] seed) (do ! - [success_assertion (/.property expected_message/0 true) - failure_assertion (/.property expected_message/0 false)] + [success_unit_test (/.test expected_message/0 true) + failure_unit_test (/.test expected_message/0 false)] (in (do async.monad - [[success_tally success_message] success_assertion - [failure_tally failure_message] failure_assertion] - (/.coverage' [/.property] + [[success_tally success_message] success_unit_test + [failure_tally failure_message] failure_unit_test] + (unit.coverage [/.test] (and (text.ends_with? (%.text expected_message/0) success_message) (text.ends_with? (%.text expected_message/0) failure_message) - (and (n.= 1 (the /.#successes success_tally)) - (n.= 0 (the /.#failures success_tally))) - (and (n.= 0 (the /.#successes failure_tally)) - (n.= 1 (the /.#failures failure_tally)))))))) + (and (n.= 1 (the unit.#successes success_tally)) + (n.= 0 (the unit.#failures success_tally))) + (and (n.= 0 (the unit.#successes failure_tally)) + (n.= 1 (the unit.#failures failure_tally)))))))) (do ! - [tt (/.and (/.property expected_message/0 true) - (/.property expected_message/1 true)) - ff (/.and (/.property expected_message/0 false) - (/.property expected_message/1 false)) - tf (/.and (/.property expected_message/0 true) - (/.property expected_message/1 false)) - ft (/.and (/.property expected_message/0 false) - (/.property expected_message/1 true))] + [tt (/.and (/.test expected_message/0 true) + (/.test expected_message/1 true)) + ff (/.and (/.test expected_message/0 false) + (/.test expected_message/1 false)) + tf (/.and (/.test expected_message/0 true) + (/.test expected_message/1 false)) + ft (/.and (/.test expected_message/0 false) + (/.test expected_message/1 true))] (in (do async.monad [tt tt ff ff tf tf ft ft] - (/.coverage' [/.and] + (unit.coverage [/.and] (and (..verify expected_message/0 expected_message/1 2 0 tt) (..verify expected_message/0 expected_message/1 0 2 ff) (..verify expected_message/0 expected_message/1 1 1 tf) (..verify expected_message/0 expected_message/1 1 1 ft)))))) (do ! - [success_assertion (/.context expected_context (/.property expected_message/0 true)) - failure_assertion (/.context expected_context (/.property expected_message/0 false))] + [success_unit_test (/.context expected_context (/.test expected_message/0 true)) + failure_unit_test (/.context expected_context (/.test expected_message/0 false))] (in (do async.monad - [[success_tally success_message] success_assertion - [failure_tally failure_message] failure_assertion] - (/.coverage' [/.context] + [[success_tally success_message] success_unit_test + [failure_tally failure_message] failure_unit_test] + (unit.coverage [/.context] (and (and (text.contains? expected_context success_message) (text.contains? expected_message/0 success_message)) (and (text.contains? expected_context failure_message) (text.contains? expected_message/0 failure_message)) - (and (n.= 1 (the /.#successes success_tally)) - (n.= 0 (the /.#failures success_tally))) - (and (n.= 0 (the /.#successes failure_tally)) - (n.= 1 (the /.#failures failure_tally)))))))) + (and (n.= 1 (the unit.#successes success_tally)) + (n.= 0 (the unit.#failures success_tally))) + (and (n.= 0 (the unit.#successes failure_tally)) + (n.= 1 (the unit.#failures failure_tally)))))))) (do ! - [failure_assertion (/.failure expected_message/0)] + [failure_unit_test (/.failure expected_message/0)] (in (do async.monad - [[failure_tally failure_message] failure_assertion] - (/.coverage' [/.failure] + [[failure_tally failure_message] failure_unit_test] + (unit.coverage [/.failure] (and (text.contains? expected_message/0 failure_message) - (and (n.= 0 (the /.#successes failure_tally)) - (n.= 1 (the /.#failures failure_tally)))))))) + (and (n.= 0 (the unit.#successes failure_tally)) + (n.= 1 (the unit.#failures failure_tally)))))))) (do ! - [success_assertion (/.lifted expected_message/0 (in true)) - failure_assertion (/.lifted expected_message/0 (in false))] + [success_unit_test (/.lifted expected_message/0 (in true)) + failure_unit_test (/.lifted expected_message/0 (in false))] (in (do async.monad - [[success_tally success_message] success_assertion - [failure_tally failure_message] failure_assertion] - (/.coverage' [/.lifted] + [[success_tally success_message] success_unit_test + [failure_tally failure_message] failure_unit_test] + (unit.coverage [/.lifted] (and (text.contains? expected_message/0 success_message) (text.contains? expected_message/0 failure_message) - (and (n.= 1 (the /.#successes success_tally)) - (n.= 0 (the /.#failures success_tally))) - (and (n.= 0 (the /.#successes failure_tally)) - (n.= 1 (the /.#failures failure_tally)))))))) + (and (n.= 1 (the unit.#successes success_tally)) + (n.= 0 (the unit.#failures success_tally))) + (and (n.= 0 (the unit.#successes failure_tally)) + (n.= 1 (the unit.#failures failure_tally)))))))) ..times ..in_parallel ..coverage diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index faebedb1f..ff12cb791 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract ["[0]" monad (.only do)]] [control @@ -24,7 +23,9 @@ ["^" pattern]]] [world [time - ["[0]" instant (.only Instant)]]]]] + ["[0]" instant (.only Instant)]]] + ["_" test (.only Test) + ["[0]" unit]]]] ["[0]" / ["[1][0]" watch]] [\\library @@ -255,7 +256,7 @@ (in (do async.monad [.let [fs (/.mock /)] ? (at fs delete file)] - (_.coverage' [/.cannot_delete] + (unit.coverage [/.cannot_delete] (case ? {try.#Failure error} (exception.match? /.cannot_delete error) @@ -265,7 +266,7 @@ (in (do async.monad [.let [fs (/.mock /)] ? (at fs read file)] - (_.coverage' [/.cannot_find_file] + (unit.coverage [/.cannot_find_file] (case ? {try.#Failure error} (exception.match? /.cannot_find_file error) @@ -276,7 +277,7 @@ [.let [fs (/.mock /)] ?/0 (at fs directory_files file) ?/1 (at fs sub_directories file)] - (_.coverage' [/.cannot_find_directory] + (unit.coverage [/.cannot_find_directory] (case [?/0 ?/1] [{try.#Failure error/0} {try.#Failure error/1}] (and (exception.match? /.cannot_find_directory error/0) diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index 9977934a0..a56fce833 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -18,7 +17,9 @@ [collection ["[0]" list]]] [math - ["[0]" random (.only Random) (.use "[1]#[0]" monad)]]]] + ["[0]" random (.only Random) (.use "[1]#[0]" monad)]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) ["/[1]" //]]] @@ -74,7 +75,7 @@ (in (do async.monad [?concern (at watcher concern directory) ?stop (at watcher stop directory)] - (_.coverage' [/.not_being_watched] + (unit.coverage [/.not_being_watched] (and (case ?concern {try.#Failure error} (exception.match? /.not_being_watched error) @@ -182,7 +183,7 @@ after_creation! after_modification! after_deletion!)))] - (_.coverage' [/.mock /.polling] + (unit.coverage [/.mock /.polling] (try.else false verdict))))) (do random.monad [directory (random.alphabetic 5) @@ -190,7 +191,7 @@ [fs watcher] (/.mock /)]] (in (do async.monad [started? (at watcher start /.all directory)] - (_.coverage' [/.cannot_poll_a_non_existent_directory] + (unit.coverage [/.cannot_poll_a_non_existent_directory] (case started? {try.#Success _} false diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index bd73d7e87..fcba904f9 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only Monad do)]] [control @@ -23,7 +22,9 @@ [math ["[0]" random (.only Random)] [number - ["[0]" nat]]]]] + ["[0]" nat]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) ["/[1]" // (.only) @@ -119,7 +120,7 @@ (verification ! <expected>))] <cases>))] - (_.coverage' [/.async] + (unit.coverage [/.async] (and (,, (with_template [<definition> <expected>] [<expected>] diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index 09126a8a3..0e3b16ce9 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["_" test (.only Test)] [abstract [monad (.only do)]] [control @@ -18,7 +17,9 @@ ["[0]" random] [number ["n" nat] - ["i" int]]]]] + ["i" int]]] + ["_" test (.only Test) + ["[0]" unit]]]] [\\library ["[0]" / (.only) [// @@ -123,6 +124,6 @@ wrote! destroyed! (i.= exit await))))] - (_.coverage' [/.Shell] + (unit.coverage [/.Shell] (try.else false verdict))))) ))) |