diff options
author | Eduardo Julian | 2019-04-19 18:49:43 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-04-19 18:49:43 -0400 |
commit | 6d4950f84e4ec1d35dff95c9816d75f360d4a349 (patch) | |
tree | f48b6d793b4175316c5636878479dc348fae0394 /stdlib/source/test | |
parent | 0ed7cb3a7d07cf92be57a8f26355212bcee0325d (diff) |
Moved the CLI parser under "lux/control/parser/".
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux.lux | 5 | ||||
-rw-r--r-- | stdlib/source/test/lux/control.lux | 6 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/parser/cli.lux (renamed from stdlib/source/test/lux/control/cli.lux) | 20 |
3 files changed, 17 insertions, 14 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index ab5d2e1d4..f62a071ae 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -12,9 +12,10 @@ [monad (#+ do)] [predicate (#+ Predicate)]] [control - [cli (#+ program:)] ["." io (#+ io)] - ["." function]] + ["." function] + [parser + [cli (#+ program:)]]] [data ["." name] [number diff --git a/stdlib/source/test/lux/control.lux b/stdlib/source/test/lux/control.lux index bacb4cb24..61d69459f 100644 --- a/stdlib/source/test/lux/control.lux +++ b/stdlib/source/test/lux/control.lux @@ -2,7 +2,6 @@ [lux #* ["_" test (#+ Test)]] ["." / #_ - ["#." cli] ["#." continuation] ["#." exception] ["#." io] @@ -20,7 +19,8 @@ ["#." actor] ["#." stm]] ["#." parser #_ - ["#/." text]] + ["#/." text] + ["#/." cli]] [security ["#." privacy] ["#." integrity]] @@ -40,6 +40,7 @@ Test ($_ _.and /parser/text.test + /parser/cli.test )) (def: security @@ -52,7 +53,6 @@ (def: #export test Test ($_ _.and - /cli.test /continuation.test /exception.test /io.test diff --git a/stdlib/source/test/lux/control/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux index ff7a3abb3..a476c97c6 100644 --- a/stdlib/source/test/lux/control/cli.lux +++ b/stdlib/source/test/lux/control/parser/cli.lux @@ -1,6 +1,8 @@ (.module: [lux #* - data/text/format + [data + text/format + ["." name]] ["M" abstract/monad (#+ Monad do)] ["_" test (#+ Test)] ["r" math/random] @@ -10,8 +12,8 @@ [data ["." error] [number - ["." nat ("#;." decimal)]] - ["." text ("#;." equivalence)] + ["." nat ("#@." decimal)]] + ["." text ("#@." equivalence)] [collection ["." list]]]] {1 @@ -19,12 +21,12 @@ (def: #export test Test - (<| (_.context (%name (name-of /.CLI))) + (<| (_.context (name.module (name-of /._))) (do r.monad [num-args (|> r.nat (:: @ map (n/% 10))) - #let [gen-arg (:: @ map nat;encode r.nat)] + #let [gen-arg (:: @ map nat@encode r.nat)] yes gen-arg - #let [gen-ignore (r.filter (|>> (text;= yes) not) + #let [gen-ignore (r.filter (|>> (text@= yes) not) (r.unicode 5))] no gen-ignore pre-ignore (r.list 5 gen-ignore) @@ -36,7 +38,7 @@ #0 (#error.Success arg) - (text;= arg yes)))) + (text@= arg yes)))) (_.test "Can test tokens." (and (|> (/.run (list yes) (/.this yes)) (case> (#error.Failure _) @@ -51,12 +53,12 @@ (#error.Success _) #0)))) (_.test "Can use custom token parsers." - (|> (/.run (list yes) (/.parse nat;decode)) + (|> (/.run (list yes) (/.parse nat@decode)) (case> (#error.Failure _) #0 (#error.Success parsed) - (text;= (nat;encode parsed) + (text@= (nat@encode parsed) yes)))) (_.test "Can query if there are any more inputs." (and (|> (/.run (list) /.end) |