aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/macro/template.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/macro/template.lux')
-rw-r--r--stdlib/source/test/lux/macro/template.lux25
1 files changed, 25 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux
index 53d7d114e..b129aaaef 100644
--- a/stdlib/source/test/lux/macro/template.lux
+++ b/stdlib/source/test/lux/macro/template.lux
@@ -3,9 +3,15 @@
["_" test (#+ Test)]
[abstract
[monad (#+ do)]]
+ [control
+ ["." try]
+ ["." exception]]
[data
[collection
["." list]]]
+ ["." macro
+ [syntax (#+ syntax:)]
+ ["." code]]
[math
["." random (#+ Random)]
[number
@@ -19,6 +25,15 @@
(-> Nat Nat)
(|>> !pow/2)))
+(syntax: (macro_error macro)
+ (function (_ compiler)
+ (case ((macro.expand macro) compiler)
+ (#try.Failure error)
+ (#try.Success [compiler (list (code.text error))])
+
+ (#try.Success _)
+ (#try.Failure "OOPS!"))))
+
(def: #export test
Test
(<| (_.covering /._)
@@ -97,5 +112,15 @@
can_refer!
can_shadow!)))
))))
+ (_.cover [/.irregular_arguments]
+ (/.with [(arity/3 <0> <1> <2>)
+ ""]
+ (exception.match? /.irregular_arguments
+ (macro_error (arity/3 "a" "b")))))
+ (_.cover [/.cannot_shadow_definition]
+ (exception.match? /.cannot_shadow_definition
+ (macro_error (/.with [(macro_error <0> <1> <2>)
+ ""]
+ ""))))
)))
))