diff options
Diffstat (limited to 'stdlib/source/test/lux/tool/compiler/default/syntax.lux')
-rw-r--r-- | stdlib/source/test/lux/tool/compiler/default/syntax.lux | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/stdlib/source/test/lux/tool/compiler/default/syntax.lux b/stdlib/source/test/lux/tool/compiler/default/syntax.lux index 632e97023..9f36c551f 100644 --- a/stdlib/source/test/lux/tool/compiler/default/syntax.lux +++ b/stdlib/source/test/lux/tool/compiler/default/syntax.lux @@ -1,7 +1,9 @@ (.module: [lux #* - data/text/format [abstract/monad (#+ do)] + [data + text/format + ["." name]] ["r" math/random (#+ Random) ("#@." monad)] ["_" test (#+ Test)] [data @@ -25,17 +27,8 @@ (def: name-part^ (Random Text) (do r.monad - [#let [digits "0123456789" - delimiters (format "()[]{}#." /.text-delimiter) - space (format " " text.new-line) - invalid-range (format digits delimiters space) - char-gen (|> r.nat - (:: @ map (|>> (n/% 256) (n/max 1))) - (r.filter (function (_ sample) - (not (text.contains? (text.from-code sample) - invalid-range)))))] - size (|> r.nat (:: @ map (|>> (n/% 20) (n/max 1))))] - (r.text char-gen size))) + [size (|> r.nat (:: @ map (|>> (n/% 20) (n/max 1))))] + (r.ascii/lower-alpha size))) (def: name^ (Random Name) @@ -49,12 +42,12 @@ (|> r.nat (r@map code.nat)) (|> r.int (r@map code.int)) (|> r.rev (r@map code.rev)) - (|> r.frac (r@map code.frac)))) + (|> r.safe-frac (r@map code.frac)))) textual^ (: (Random Code) ($_ r.either (do r.monad [size (|> r.nat (r@map (n/% 20)))] - (|> (r.unicode size) (r@map code.text))) + (|> (r.ascii/upper-alpha size) (r@map code.text))) (|> name^ (r@map code.identifier)) (|> name^ (r@map code.tag)))) simple^ (: (Random Code) @@ -146,7 +139,8 @@ (def: #export test Test - ($_ _.and - ..code - ..comments - )) + (<| (_.context (name.module (name-of /._))) + ($_ _.and + ..code + ..comments + ))) |