aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/aedifex.lux13
-rw-r--r--stdlib/source/test/lux.lux27
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta/cli.lux3
-rw-r--r--stdlib/source/test/lux/program.lux80
4 files changed, 59 insertions, 64 deletions
diff --git a/stdlib/source/test/aedifex.lux b/stdlib/source/test/aedifex.lux
index 790b09bdc..f30ec52c0 100644
--- a/stdlib/source/test/aedifex.lux
+++ b/stdlib/source/test/aedifex.lux
@@ -1,7 +1,7 @@
(.require
[library
[lux (.except)
- [program (.only program:)]
+ [program (.only program)]
["_" test (.only Test)]
[control
["[0]" io]]]]
@@ -54,8 +54,9 @@
/runtime.test
))
-(program: args
- (<| io.io
- _.run!
- (_.times 100)
- ..test))
+(def _
+ (program args
+ (<| io.io
+ _.run!
+ (_.times 100)
+ ..test)))
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 04d1ca0f9..74983c2a1 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -1,7 +1,7 @@
(.`` (.`` (.require
[library
["/" lux (.except)
- [program (.only program:)]
+ [program (.only program)]
["_" test (.only Test)]
[abstract
[monad (.only do)]]
@@ -1212,15 +1212,16 @@
/ffi.test
))))
-(program: args
- (let [times (for @.old 100
- @.jvm 100
- @.js 10
- @.python 1
- @.lua 1
- @.ruby 1
- 100)]
- (<| io.io
- _.run!
- (_.times times)
- ..test)))
+(def _
+ (program args
+ (let [times (for @.old 100
+ @.jvm 100
+ @.js 10
+ @.python 1
+ @.lua 1
+ @.ruby 1
+ 100)]
+ (<| io.io
+ _.run!
+ (_.times times)
+ ..test))))
diff --git a/stdlib/source/test/lux/meta/compiler/meta/cli.lux b/stdlib/source/test/lux/meta/compiler/meta/cli.lux
index 28bc83c3b..156804e1a 100644
--- a/stdlib/source/test/lux/meta/compiler/meta/cli.lux
+++ b/stdlib/source/test/lux/meta/compiler/meta/cli.lux
@@ -40,6 +40,7 @@
libraries (random.list amount (random.lower_case 3))
target (random.lower_case 4)
module (random.lower_case 5)
+ program (random.lower_case 6)
compilers (random.list amount $/compiler.random)
configuration ($configuration.random 5)
.let [compilation' (all list#composite
@@ -128,6 +129,7 @@
/.#sources sources
/.#target target
/.#module module
+ /.#program {.#Some program}
/.#configuration configuration]}]
[{/.#Interpretation [/.#host_dependencies host_dependencies
/.#libraries libraries
@@ -135,6 +137,7 @@
/.#sources sources
/.#target target
/.#module module
+ /.#program {.#Some program}
/.#configuration configuration]}]
[{/.#Export [sources target]}]
)))))
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
))))