diff options
author | Eduardo Julian | 2021-01-03 07:48:12 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-01-03 07:48:12 -0400 |
commit | c03bd9f9787fb9f383c57b4ebb0fa9d49abbfaa1 (patch) | |
tree | 68a7f2f043eff00492ffe2b5e442bae98167a873 /stdlib/source/test/lux/macro | |
parent | 02d27daeacac74785c2b0f4d1ce03d432377a36e (diff) |
Place the "program:" macro of "lux/control/parser/cli" in its own module.
Diffstat (limited to 'stdlib/source/test/lux/macro')
-rw-r--r-- | stdlib/source/test/lux/macro/code.lux | 1 | ||||
-rw-r--r-- | stdlib/source/test/lux/macro/poly/equivalence.lux | 16 | ||||
-rw-r--r-- | stdlib/source/test/lux/macro/poly/functor.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/macro/syntax/common.lux | 17 | ||||
-rw-r--r-- | stdlib/source/test/lux/macro/syntax/common/annotations.lux | 3 | ||||
-rw-r--r-- | stdlib/source/test/lux/macro/syntax/common/type/variable.lux | 37 |
6 files changed, 55 insertions, 25 deletions
diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index 1244b84e4..0f217e335 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -119,6 +119,7 @@ ($_ _.and (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) + (_.for [/.format] (`` ($_ _.and (~~ (template [<coverage> <random> <tag>] diff --git a/stdlib/source/test/lux/macro/poly/equivalence.lux b/stdlib/source/test/lux/macro/poly/equivalence.lux index c1edf6022..593dba8e1 100644 --- a/stdlib/source/test/lux/macro/poly/equivalence.lux +++ b/stdlib/source/test/lux/macro/poly/equivalence.lux @@ -6,7 +6,10 @@ [monad (#+ do)] [equivalence (#+ Equivalence) {[0 #poly] - ["." /]}]] + ["." /]}] + {[0 #spec] + [/ + ["$." equivalence]]}] [data ["." bit] ["." maybe] @@ -48,7 +51,7 @@ (random.and random.safe_frac gen_recursive))))) -(def: gen_record +(def: random (Random Record) (do {! random.monad} [size (\ ! map (n.% 2) random.nat) @@ -75,9 +78,6 @@ (def: #export test Test - (<| (_.context (%.name (name_of /._))) - (do random.monad - [sample gen_record - #let [(^open "/\.") ..equivalence]] - (_.test "Every instance equals itself." - (/\= sample sample))))) + (<| (_.covering /._) + (_.for [/.equivalence] + ($equivalence.spec ..equivalence ..random)))) diff --git a/stdlib/source/test/lux/macro/poly/functor.lux b/stdlib/source/test/lux/macro/poly/functor.lux index 3f2b4db50..9463d7f11 100644 --- a/stdlib/source/test/lux/macro/poly/functor.lux +++ b/stdlib/source/test/lux/macro/poly/functor.lux @@ -22,6 +22,6 @@ (def: #export test Test - (<| (_.context (%.name (name_of /._))) - (_.test "Can derive functors automatically." - true))) + (<| (_.covering /._) + (_.cover [/.functor] + true))) diff --git a/stdlib/source/test/lux/macro/syntax/common.lux b/stdlib/source/test/lux/macro/syntax/common.lux index 429b7fc6e..2929417e3 100644 --- a/stdlib/source/test/lux/macro/syntax/common.lux +++ b/stdlib/source/test/lux/macro/syntax/common.lux @@ -33,7 +33,9 @@ ["#." check] ["#." declaration] ["#." definition] - ["#." export]]) + ["#." export] + ["#." type #_ + ["#/." variable]]]) (def: random_text (Random Text) @@ -46,18 +48,6 @@ (_.covering /writer._) ($_ _.and (do {! random.monad} - [size (\ ! map (|>> (n.% 3)) random.nat) - expected (random.list size ..random_text)] - (_.cover [/.Type_Var /reader.type_variables /writer.type_variables] - (|> expected - /writer.type_variables - (<c>.run /reader.type_variables) - (case> (#try.Success actual) - (\ (list.equivalence text.equivalence) = expected actual) - - (#try.Failure error) - false)))) - (do {! random.monad} [expected (: (Random /.Typed_Input) (random.and ///code.random ///code.random))] @@ -77,4 +67,5 @@ /declaration.test /definition.test /export.test + /type/variable.test ))) diff --git a/stdlib/source/test/lux/macro/syntax/common/annotations.lux b/stdlib/source/test/lux/macro/syntax/common/annotations.lux index bc29a00f6..b1369ef48 100644 --- a/stdlib/source/test/lux/macro/syntax/common/annotations.lux +++ b/stdlib/source/test/lux/macro/syntax/common/annotations.lux @@ -49,4 +49,5 @@ false (#try.Success actual) - (\ /.equivalence = expected actual))))))) + (\ /.equivalence = expected actual)))) + ))) diff --git a/stdlib/source/test/lux/macro/syntax/common/type/variable.lux b/stdlib/source/test/lux/macro/syntax/common/type/variable.lux new file mode 100644 index 000000000..4701f5aef --- /dev/null +++ b/stdlib/source/test/lux/macro/syntax/common/type/variable.lux @@ -0,0 +1,37 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)] + {[0 #spec] + [/ + ["$." equivalence]]}] + [control + ["." try ("#\." functor)] + [parser + ["<.>" code]]] + [math + ["." random (#+ Random)]]] + {1 + ["." /]}) + +(def: #export random + (Random /.Variable) + (random.ascii/alpha 10)) + +(def: #export test + Test + (<| (_.covering /._) + (_.for [/.Variable]) + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [expected ..random] + (_.cover [/.format /.parser] + (|> (list (/.format expected)) + (<code>.run /.parser) + (try\map (\ /.equivalence = expected)) + (try.default false)))) + ))) |