diff options
author | Eduardo Julian | 2022-06-05 01:39:29 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-06-05 01:39:29 -0400 |
commit | f623de52d76ad8ec96feb048cd95a3fb150717e1 (patch) | |
tree | 92a53eb8e5a25287e59eb104716abe5cc2ebd60a /stdlib/source/test/lux.lux | |
parent | 75e8244fd7914d2ac0c3622d2277b84c4bfa7ffb (diff) |
De-sigil-ification: : [Part 1]
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux.lux | 38 |
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)) |