aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/program.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/program.lux80
1 files changed, 35 insertions, 45 deletions
diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux
index 1f31b3874..c2e473f46 100644
--- a/stdlib/source/test/lux/program.lux
+++ b/stdlib/source/test/lux/program.lux
@@ -91,58 +91,48 @@
(!expect {try.#Failure _}))))
))))
-(def actual_program
- (syntax (_ [actual_program (<| <code>.form
- (<>.after (<code>.this_text "lux def program"))
- <code>.any)])
- (in (list actual_program))))
-
(def .public test
Test
(<| (_.covering /._)
(do random.monad
[inputs (random.list 5 (random.upper_case 5))]
(all _.and
- (_.coverage [/.program:]
+ (_.coverage [/.program]
(let [(open "list#[0]") (list.equivalence text.equivalence)]
- (and (with_expansions [<program> (/.program: all_arguments
- (io.io all_arguments))]
- (let [outcome ((is (-> (List Text) (io.IO Any))
- (..actual_program <program>))
- inputs)]
- (same? (is Any inputs)
- (io.run! outcome))))
- (with_expansions [<program> (/.program: [arg/0 \\parser.any
- arg/1 \\parser.any
- arg/2 \\parser.any
- arg/3 \\parser.any
- arg/4 \\parser.any]
- (io.io (list arg/4 arg/3 arg/2 arg/1 arg/0)))]
- (let [outcome ((is (-> (List Text) (io.IO Any))
- (..actual_program <program>))
- inputs)]
- (list#= (list.reversed inputs)
- (as (List Text) (io.run! outcome)))))
- (with_expansions [<program> (/.program: [all_arguments (<>.many \\parser.any)]
- (io.io all_arguments))]
- (let [outcome ((is (-> (List Text) (io.IO Any))
- (..actual_program <program>))
- inputs)]
- (list#= inputs
- (as (List Text) (io.run! outcome)))))
- (with_expansions [<program> (/.program: [arg/0 \\parser.any
- arg/1 \\parser.any
- arg/2 \\parser.any
- arg/3 \\parser.any]
- (io.io []))]
- (case (try ((is (-> (List Text) (io.IO Any))
- (..actual_program <program>))
- inputs))
- {try.#Success _}
- false
-
- {try.#Failure _}
- true)))))
+ (and (let [outcome ((is /.Program
+ (/.program all_arguments
+ (io.io all_arguments)))
+ inputs)]
+ (same? (is Any inputs)
+ (io.run! outcome)))
+ (let [outcome ((is /.Program
+ (/.program [arg/0 \\parser.any
+ arg/1 \\parser.any
+ arg/2 \\parser.any
+ arg/3 \\parser.any
+ arg/4 \\parser.any]
+ (io.io (list arg/4 arg/3 arg/2 arg/1 arg/0))))
+ inputs)]
+ (list#= (list.reversed inputs)
+ (as (List Text) (io.run! outcome))))
+ (let [outcome ((is /.Program
+ (/.program [all_arguments (<>.many \\parser.any)]
+ (io.io all_arguments)))
+ inputs)]
+ (list#= inputs
+ (as (List Text) (io.run! outcome))))
+ (case (try ((is /.Program
+ (/.program [arg/0 \\parser.any
+ arg/1 \\parser.any
+ arg/2 \\parser.any
+ arg/3 \\parser.any]
+ (io.io [])))
+ inputs))
+ {try.#Success _}
+ false
+
+ {try.#Failure _}
+ true))))
..\\parser
))))