diff options
author | Eduardo Julian | 2022-02-23 05:30:53 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-02-23 05:30:53 -0400 |
commit | f27a91a7b67790272578692ea20e2d875dbb3d35 (patch) | |
tree | cf0d9a53f3ef1b16be92ee5a120651b1abbb866d /stdlib/source/test/lux/meta/version.lux | |
parent | f07effd9faf3fdaa677f659d6bbccf98931c5e5a (diff) |
ADDED Can pass config parameters to compiler and select code based on it. Can also select code based on compiler version.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/meta/version.lux | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/meta/version.lux b/stdlib/source/test/lux/meta/version.lux new file mode 100644 index 000000000..a279158ab --- /dev/null +++ b/stdlib/source/test/lux/meta/version.lux @@ -0,0 +1,55 @@ +(.using + [library + [lux "*" + ["_" test {"+" Test}] + ["[0]" static] + ["[0]" meta] + [abstract + [monad {"+" do}]] + [control + ["[0]" try] + ["[0]" exception] + [parser + ["<[0]>" code]]] + [data + ["[0]" text]] + ["[0]" macro + [syntax {"+" syntax:}] + ["[0]" code]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) + +(syntax: (failure [it <code>.any]) + (function (_ lux) + (case (macro.expansion it lux) + {try.#Failure error} + {try.#Success [lux (list (code.text error))]} + + {try.#Success _} + {try.#Failure ""}))) + +(def: .public test + Test + (<| (_.covering /._) + (with_expansions [<current> (/.current) + <fake> (static.random code.text (random.ascii/lower 1))]) + ($_ _.and + (_.cover [/.latest] + (n.> 0 /.latest)) + (_.cover [/.current] + (not (text.empty? (/.current)))) + (_.cover [/.for] + (and (/.for [<current> true] + false) + (/.for [<fake> false] + true))) + (_.cover [/.invalid] + (and (text.contains? (value@ exception.#label /.invalid) + (..failure (/.for []))) + (text.contains? (value@ exception.#label /.invalid) + (..failure (/.for [<fake> false]))))) + ))) |