aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/lux.lux1
-rw-r--r--stdlib/source/test/lux/control/security/policy.lux5
-rw-r--r--stdlib/source/test/lux/meta.lux4
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase.lux4
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/host.lux7
-rw-r--r--stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/primitive.lux51
-rw-r--r--stdlib/source/test/lux/meta/compiler/meta.lux6
-rw-r--r--stdlib/source/test/lux/world/console.lux56
-rw-r--r--stdlib/source/test/lux/world/environment.lux27
-rw-r--r--stdlib/source/test/lux/world/finance/money.lux8
10 files changed, 137 insertions, 32 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index bda6c17fc..be6350aa8 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -6,7 +6,6 @@
[monad (.only do)]]
[control
["[0]" io]
- ["[0]" try]
["[0]" maybe (.use "[1]#[0]" functor)]
[concurrency
["[0]" atom (.only Atom)]]]
diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux
index 59f6968e3..0919d422a 100644
--- a/stdlib/source/test/lux/control/security/policy.lux
+++ b/stdlib/source/test/lux/control/security/policy.lux
@@ -92,7 +92,10 @@
(_.for [/.monad]
(monadT.spec (..injection (of policy_0 #can_upgrade)) (..comparison (of policy_0 #can_downgrade)) /.monad))))
- (_.coverage [/.Privilege /.Context /.with_policy]
+ (_.coverage [/.Privilege
+ /.#can_upgrade /.#can_downgrade
+
+ /.Context /.with_policy]
(and (of policy_0 = password password)
(n.= (of text.hash hash raw_password)
(of policy_0 hash password))))
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index 477d1e31e..1043b77c2 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -57,8 +57,6 @@
["[1][0]" compiler
... ["[1]/[0]" phase]
... ["[1]/[0]" meta
- ... ["[1]/[0]" cli]
- ... ["[1]/[0]" export]
... ["[1]/[0]" import]
... ["[1]/[0]" context]
... ["[1]/[0]" cache]]
@@ -1067,8 +1065,6 @@
/global.test
/compiler.test
- ... /compiler/meta/cli.test
- ... /compiler/meta/export.test
... /compiler/meta/import.test
... /compiler/meta/context.test
... /compiler/meta/cache.test
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux
index c0ceabbd7..ce1def236 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux
@@ -28,7 +28,8 @@
["[0]" /
["[1][0]" translation
["[1]/[0]" jvm
- ["[1]/[0]" host]]]])
+ ["[1]/[0]" host]
+ ["[1]/[0]" primitive]]]])
(def (injection value)
(All (_ of)
@@ -213,4 +214,5 @@
..test|phase)
/translation/jvm/host.test
+ /translation/jvm/primitive.test
)))
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/host.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/host.lux
index c311d107a..698a6d326 100644
--- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/host.lux
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/host.lux
@@ -14,8 +14,7 @@
[meta
[target
[jvm
- ["[0]" bytecode]
- ["[0]" type]]]]
+ ["[0]" bytecode]]]]
[test
["_" property (.only Test)]]]]
[\\library
@@ -25,9 +24,7 @@
Test
(<| (_.covering /._)
(do [! random.monad]
- [$module random.nat
- $artifact random.nat
- .let [$unit [$module $artifact]]
+ [.let [$unit [0 0]]
expected (random.upper_cased 1)])
(all _.and
(_.coverage [/.host]
diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/primitive.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/primitive.lux
new file mode 100644
index 000000000..de32bc4a0
--- /dev/null
+++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/primitive.lux
@@ -0,0 +1,51 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]]
+ [control
+ ["[0]" io]
+ ["[0]" try]]
+ [data
+ ["[0]" bit (.use "[1]#[0]" equivalence)]
+ ["[0]" text (.use "[1]#[0]" equivalence)]]
+ [math
+ ["[0]" random (.only Random)]
+ [number
+ ["[0]" int (.use "[1]#[0]" equivalence)]
+ ["[0]" frac (.use "[1]#[0]" equivalence)]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" / (.only)
+ [//
+ ["[0]" host]]]])
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [expected_bit random.bit
+ expected_i64 random.i64
+ expected_f64 random.frac
+ expected_text (random.lower_cased 1)
+
+ .let [$unit [0 0]]])
+ (`` (all _.and
+ (,, (with_template [<constructor> <expected> <type> <=>]
+ [(_.coverage [<constructor>]
+ (io.run! (do io.monad
+ [[class_loader host] host.host]
+ (in (when (of host evaluate $unit [{.#None} (<constructor> <expected>)])
+ {try.#Success actual}
+ (<=> <expected> (as <type> actual))
+
+ {try.#Failure error}
+ false)))))]
+
+ [/.bit expected_bit Bit bit#=]
+ [/.i64 expected_i64 Int int#=]
+ [/.f64 expected_f64 Frac frac#=]
+ [/.text expected_text Text text#=]
+ ))
+ ))))
diff --git a/stdlib/source/test/lux/meta/compiler/meta.lux b/stdlib/source/test/lux/meta/compiler/meta.lux
index c2d1ac5c6..e127adcbc 100644
--- a/stdlib/source/test/lux/meta/compiler/meta.lux
+++ b/stdlib/source/test/lux/meta/compiler/meta.lux
@@ -15,7 +15,9 @@
["[0]" /]]
["[0]" /
["[1][0]" io]
- ["[1][0]" archive]])
+ ["[1][0]" archive]
+ ["[1][0]" cli]
+ ["[1][0]" export]])
(def .public test
Test
@@ -29,4 +31,6 @@
/io.test
/archive.test
+ /cli.test
+ /export.test
)))
diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux
index 7d933d926..4e26b107c 100644
--- a/stdlib/source/test/lux/world/console.lux
+++ b/stdlib/source/test/lux/world/console.lux
@@ -4,20 +4,62 @@
[abstract
[monad (.only do)]]
[control
- ["[0]" io]
+ ["[0]" io (.only IO)]
["[0]" try (.only Try)]
- ["[0]" exception]]
+ ["[0]" exception]
+ [concurrency
+ ["[0]" async (.only Async)]]]
[data
["[0]" text (.use "[1]#[0]" equivalence)
["%" \\format (.only format)]]]
[math
["[0]" random]]
[test
- ["_" property (.only Test)]]]]
+ ["_" property (.only Test)]
+ ["[0]" unit]]]]
[\\library
- ["[0]" /]]
- [\\specification
- ["$[0]" /]])
+ ["[0]" /]])
+
+(def .public (spec console)
+ (-> (IO (/.Console Async))
+ Test)
+ (do random.monad
+ [message (random.alphabetic 10)]
+ (in (do async.monad
+ [console (async.future console)
+ ?write (of console write (format message text.new_line))
+ ?read (of console read [])
+ ?read_line (of console read_line [])
+ ?close/good (of console close [])
+ ?close/bad (of console close [])
+
+ .let [can_write!
+ (when ?write
+ {try.#Success _}
+ true
+
+ _
+ false)
+
+ can_read!
+ (when [?read ?read_line]
+ [{try.#Success _} {try.#Success _}]
+ true
+
+ _
+ false)
+
+ can_close!
+ (when [?close/good ?close/bad]
+ [{try.#Success _} {try.#Failure _}]
+ true
+
+ _
+ false)]]
+ (unit.coverage [/.Console]
+ (and can_write!
+ can_read!
+ can_close!))))))
(exception.def dead)
@@ -54,7 +96,7 @@
(<| (_.covering /._)
(all _.and
(_.for [/.async /.mock /.Mock]
- ($/.spec (io.io (/.async (/.mock ..mock [false ""])))))
+ (..spec (io.io (/.async (/.mock ..mock [false ""])))))
(do random.monad
[expected (random.alphabetic 10)
.let [console (/.mock ..mock [false ""])]]
diff --git a/stdlib/source/test/lux/world/environment.lux b/stdlib/source/test/lux/world/environment.lux
index 8c2484e7b..c6b2e95e2 100644
--- a/stdlib/source/test/lux/world/environment.lux
+++ b/stdlib/source/test/lux/world/environment.lux
@@ -9,7 +9,9 @@
["[0]" io]
["[0]" maybe (.use "[1]#[0]" functor)]
["[0]" try]
- ["[0]" exception]]
+ ["[0]" exception]
+ [concurrency
+ ["[0]" async (.only Async)]]]
[data
["[0]" text (.use "[1]#[0]" equivalence)]
[collection
@@ -20,14 +22,27 @@
[number
["n" nat]]]
[test
- ["_" property (.only Test)]]]]
+ ["_" property (.only Test)]
+ ["[0]" unit]]]]
["[0]" \\parser (.only Environment)]
[\\library
["[0]" / (.only)
[//
- [file (.only Path)]]]]
- [\\specification
- ["$[0]" /]])
+ [file (.only Path)]]]])
+
+(def .public (spec subject)
+ (-> (/.Environment Async)
+ Test)
+ (do random.monad
+ [exit random.int]
+ (in (do [! async.monad]
+ [environment (/.environment ! subject)]
+ (unit.coverage [/.Environment]
+ (and (not (dictionary.empty? environment))
+ (list.every? (|>> text.empty? not)
+ (dictionary.keys environment))
+ (not (text.empty? (of subject home)))
+ (not (text.empty? (of subject directory)))))))))
(def \\parser
Test
@@ -84,7 +99,7 @@
unknown (random.alphabetic 1)]
(all _.and
(_.for [/.mock /.async]
- ($/.spec (/.async (/.mock environment home directory))))
+ (..spec (/.async (/.mock environment home directory))))
(_.coverage [/.environment]
(let [it (/.mock environment home directory)]
(io.run!
diff --git a/stdlib/source/test/lux/world/finance/money.lux b/stdlib/source/test/lux/world/finance/money.lux
index 872414dbf..cc798afdd 100644
--- a/stdlib/source/test/lux/world/finance/money.lux
+++ b/stdlib/source/test/lux/world/finance/money.lux
@@ -90,12 +90,8 @@
(bit#= (/.<= expected_parameter expected_subject)
(/.>= expected_subject expected_parameter)))
))
- (_.coverage [/.units /.sub_units]
- (let [expected (/.money currency.usd expected_amount)
- actual (/.money currency.usd (n.+ (/.units expected)
- (/.sub_units expected)))]
- (/.= expected actual)))
- (_.coverage [/.of_units /.of_sub_units]
+ (_.coverage [/.units /.sub_units
+ /.of_units /.of_sub_units]
(let [expected (/.money currency.usd expected_amount)
actual (/.+ (/.of_units currency.usd (/.units expected))
(/.of_sub_units currency.usd (/.sub_units expected)))]