aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux.lux')
-rw-r--r--stdlib/source/test/lux.lux38
1 files changed, 9 insertions, 29 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index ac59df0cc..d83a447f5 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -24,7 +24,7 @@
["[0]" set (.only Set) (.open: "[1]#[0]" equivalence)]
[dictionary
["[0]" plist]]]]
- ["[0]" macro
+ ["[0]" macro (.only)
[syntax (.only syntax:)]
["^" pattern]
["[0]" code (.open: "[1]#[0]" equivalence)]
@@ -375,31 +375,17 @@
(location#= location.dummy)))
)))
-(/.macro: (identity_macro tokens)
- (at meta.monad in tokens))
+(def: identity_macro
+ (/.macro (_ tokens)
+ (at meta.monad in tokens)))
(def: crosshair
"This is an arbitrary text whose only purpose is to be found, somewhere, in the source-code.")
-(/.macro: (found_crosshair? tokens lux)
- (let [[_ _ source_code] (the .#source lux)]
- {.#Right [lux (list (code.bit (text.contains? ..crosshair source_code)))]}))
-
-(/.macro: (sum tokens)
- (loop (again [tokens tokens
- output 0])
- (case tokens
- {.#End}
- (meta#in (list (code.nat output)))
-
- {.#Item [_ {.#Nat head}] tail}
- (again tail (n.+ head output))
-
- _
- (meta.failure ""))))
-
-(/.macro: (sum' tokens lux)
- ((/.macro ..sum) tokens lux))
+(def: found_crosshair?
+ (macro (_ tokens lux)
+ (let [[_ _ source_code] (the .#source lux)]
+ {.#Right [lux (list (code.bit (text.contains? ..crosshair source_code)))]})))
(def: for_macro
Test
@@ -419,17 +405,11 @@
(is /.Macro)
(is Any)
(same? (is Any macro))))
- (_.coverage [/.macro:]
+ (_.coverage [/.macro]
(same? expected (..identity_macro expected)))
(~~ (for @.old (~~ (these))
(_.coverage [/.Source]
(..found_crosshair?))))
- (_.coverage [/.macro]
- (with_expansions [n/0 (static.random_nat)
- n/1 (static.random_nat)
- n/1 (static.random_nat)]
- (n.= (..sum n/0 n/1 n/1)
- (..sum' n/0 n/1 n/1))))
(_.coverage [/.using]
(`` (with_expansions [<referral> ("lux in-module" "library/lux" library/lux.refer)
<alias> (static.random code.text (random.lower_case 1))