aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/lux/macro.lux4
-rw-r--r--stdlib/source/test/lux/macro/context.lux12
-rw-r--r--stdlib/source/test/lux/type/primitive.lux118
3 files changed, 66 insertions, 68 deletions
diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux
index 445792fb6..9368e2a0f 100644
--- a/stdlib/source/test/lux/macro.lux
+++ b/stdlib/source/test/lux/macro.lux
@@ -34,7 +34,8 @@
["[1][0]" local]
["[1][0]" syntax]
["[1][0]" template]
- ["[1][0]" pattern]])
+ ["[1][0]" pattern]
+ ["[1][0]" context]])
(def !expect
(template (_ <pattern> <value>)
@@ -248,4 +249,5 @@
/syntax.test
/template.test
/pattern.test
+ /context.test
)))
diff --git a/stdlib/source/test/lux/macro/context.lux b/stdlib/source/test/lux/macro/context.lux
new file mode 100644
index 000000000..52df97710
--- /dev/null
+++ b/stdlib/source/test/lux/macro/context.lux
@@ -0,0 +1,12 @@
+(.require
+ [library
+ [lux (.except)
+ ["_" test (.only Test)]]]
+ [\\library
+ ["[0]" /]])
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (_.property "TBD" false)
+ ))
diff --git a/stdlib/source/test/lux/type/primitive.lux b/stdlib/source/test/lux/type/primitive.lux
index dfd3aa939..619b2b3f9 100644
--- a/stdlib/source/test/lux/type/primitive.lux
+++ b/stdlib/source/test/lux/type/primitive.lux
@@ -35,72 +35,56 @@
[specific (/.specific (template.text [g!Foo]))]
)
- (def with_no_active_frames
- (syntax (_ [macro <code>.any])
- (function (_ compiler)
- (let [verdict (case ((macro.expansion macro) compiler)
- {try.#Failure error}
- (exception.match? /.no_active_frames error)
-
- {try.#Success _}
- false)]
- {try.#Success [compiler (list (code.bit verdict))]}))))
+ (/.primitive (g!Foo a)
+ Text
- (with_expansions [no_current! (..with_no_active_frames (..current))
- no_specific! (..with_no_active_frames (..specific))]
- (/.primitive (g!Foo a)
- Text
+ (/.primitive (g!Bar a)
+ Nat
- (/.primitive (g!Bar a)
- Nat
-
- (def .public test
- Test
- (<| (_.covering /._)
- (_.for [/.primitive])
- (do random.monad
- [expected_foo (random.lower_case 5)
- expected_bar random.nat]
- (all _.and
- (_.coverage [/.abstraction]
- (and (exec (is (g!Foo Text)
- (/.abstraction g!Foo expected_foo))
- true)
- (exec (is (g!Bar Text)
- (/.abstraction expected_bar))
- true)))
- (_.coverage [/.representation]
- (and (|> expected_foo
- (/.abstraction g!Foo)
- (is (g!Foo Bit))
- (/.representation g!Foo)
- (text#= expected_foo))
- (|> (/.abstraction expected_bar)
- (is (g!Bar Bit))
- /.representation
- (n.= expected_bar))))
- (_.coverage [/.transmutation]
- (and (exec (|> expected_foo
- (/.abstraction g!Foo)
- (is (g!Foo .Macro))
- (/.transmutation g!Foo)
- (is (g!Foo .Lux)))
- true)
- (exec (|> (/.abstraction expected_bar)
- (is (g!Bar .Macro))
- /.transmutation
- (is (g!Bar .Lux)))
- true)))
- (_.for [/.Frame]
- (all _.and
- (_.coverage [/.current]
- (text#= (template.text [g!Bar])
- (..current)))
- (_.coverage [/.specific]
- (text#= (template.text [g!Foo])
- (..specific)))
- (_.coverage [/.no_active_frames]
- (and no_current!
- no_specific!))
- ))
- )))))))))
+ (def .public test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.primitive])
+ (do random.monad
+ [expected_foo (random.lower_case 5)
+ expected_bar random.nat]
+ (all _.and
+ (_.coverage [/.abstraction]
+ (and (exec (is (g!Foo Text)
+ (/.abstraction g!Foo expected_foo))
+ true)
+ (exec (is (g!Bar Text)
+ (/.abstraction expected_bar))
+ true)))
+ (_.coverage [/.representation]
+ (and (|> expected_foo
+ (/.abstraction g!Foo)
+ (is (g!Foo Bit))
+ (/.representation g!Foo)
+ (text#= expected_foo))
+ (|> (/.abstraction expected_bar)
+ (is (g!Bar Bit))
+ /.representation
+ (n.= expected_bar))))
+ (_.coverage [/.transmutation]
+ (and (exec (|> expected_foo
+ (/.abstraction g!Foo)
+ (is (g!Foo .Macro))
+ (/.transmutation g!Foo)
+ (is (g!Foo .Lux)))
+ true)
+ (exec (|> (/.abstraction expected_bar)
+ (is (g!Bar .Macro))
+ /.transmutation
+ (is (g!Bar .Lux)))
+ true)))
+ (_.for [/.Frame]
+ (all _.and
+ (_.coverage [/.current]
+ (text#= (template.text [g!Bar])
+ (..current)))
+ (_.coverage [/.specific]
+ (text#= (template.text [g!Foo])
+ (..specific)))
+ ))
+ ))))))))