aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
authorEduardo Julian2022-06-15 23:13:48 -0400
committerEduardo Julian2022-06-15 23:13:48 -0400
commitf92c806ee8da63f04bbefbf558f6249bacdb47ea (patch)
treef0ff0c93cfcf68bded11c9676b65232f30032628 /stdlib/source/test
parent24986506e8beb5074f6aca048506389e90e196bd (diff)
Better syntax for the "sharing" and "by_example" macros.
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/lux/control/region.lux18
-rw-r--r--stdlib/source/test/lux/data/collection/tree/finger.lux7
-rw-r--r--stdlib/source/test/lux/documentation.lux41
-rw-r--r--stdlib/source/test/lux/type.lux16
4 files changed, 39 insertions, 43 deletions
diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux
index 258436915..999d1fa6b 100644
--- a/stdlib/source/test/lux/control/region.lux
+++ b/stdlib/source/test/lux/control/region.lux
@@ -59,17 +59,15 @@
(Comparison (All (_ a) (All (_ ! r) (Region r (Thread !) a))))
(function (_ == left right)
(case [(sharing [a]
- (Equivalence a)
- ==
-
- (Try a)
- (thread.result (as_expected (/.run! thread.monad left))))
+ (is (Equivalence a)
+ ==)
+ (is (Try a)
+ (thread.result (as_expected (/.run! thread.monad left)))))
(sharing [a]
- (Equivalence a)
- ==
-
- (Try a)
- (thread.result (as_expected (/.run! thread.monad right))))]
+ (is (Equivalence a)
+ ==)
+ (is (Try a)
+ (thread.result (as_expected (/.run! thread.monad right)))))]
[{try.#Success left} {try.#Success right}]
(== left right)
diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux
index 65bf9e589..bb6d9ac98 100644
--- a/stdlib/source/test/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/test/lux/data/collection/tree/finger.lux
@@ -23,10 +23,9 @@
(def: :@:
(by_example [@]
- (/.Builder @ Text)
- ..builder
-
- @))
+ (is (/.Builder @ Text)
+ ..builder)
+ @))
(def: .public test
Test
diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux
index 9c4f1fc2a..600030da4 100644
--- a/stdlib/source/test/lux/documentation.lux
+++ b/stdlib/source/test/lux/documentation.lux
@@ -44,8 +44,9 @@
Nat
123)
- (/.documentation: /.documentation:
- 'definition_description')
+ (def: documentation
+ (/.documentation /.documentation
+ 'definition_description'))
(def: .public test
Test
@@ -67,13 +68,13 @@
_
false))
- (_.coverage [/.documentation:]
- (case ..documentation:
- (pattern (list documentation:))
- (and (|> documentation:
+ (_.coverage [/.documentation]
+ (case ..documentation
+ (pattern (list documentation))
+ (and (|> documentation
(the /.#definition)
- (text#= (template.text [/.documentation:])))
- (|> documentation:
+ (text#= (template.text [/.documentation])))
+ (|> documentation
(the /.#documentation)
md.markdown
(text.contains? 'definition_description')))
@@ -83,25 +84,25 @@
))
(_.for [/.Module]
(all _.and
- (_.coverage [/.module /.documentation]
+ (_.coverage [/.module /.markdown]
(let [sub (`` (/.module /._
(~~ (template.text ['sub_description']))
[]
[]))
super (`` (/.module .._
(~~ (template.text ['super_description']))
- [..documentation:]
+ [..documentation]
[sub]))]
(and (text.contains? (template.text ['sub_description'])
- (/.documentation sub))
- (text.contains? (/.documentation sub)
- (/.documentation super))
+ (/.markdown sub))
+ (text.contains? (/.markdown sub)
+ (/.markdown super))
(text.contains? (template.text ['super_description'])
- (/.documentation super))
- (case ..documentation:
- (pattern (list documentation:))
- (text.contains? (md.markdown (the /.#documentation documentation:))
- (/.documentation super))
+ (/.markdown super))
+ (case ..documentation
+ (pattern (list documentation))
+ (text.contains? (md.markdown (the /.#documentation documentation))
+ (/.markdown super))
_
false))))
@@ -111,11 +112,11 @@
[(macro_error <example>)]
[(/.default g!default)]
- [(/.documentation: g!default
+ [(/.documentation g!default
(~~ (template.text ['definition_description'])))]
[(/.module g!default
""
- [..documentation:]
+ [..documentation]
[sub])]
)))))
)))))
diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux
index f14d09760..e365ab360 100644
--- a/stdlib/source/test/lux/type.lux
+++ b/stdlib/source/test/lux/type.lux
@@ -199,10 +199,9 @@
{.#None})]
(/#= (.type (List Nat))
(/.by_example [a]
- (Maybe a)
- example
-
- (List a)))))
+ (is (Maybe a)
+ example)
+ (List a)))))
(do random.monad
[sample random.nat]
(_.coverage [/.log!]
@@ -223,11 +222,10 @@
(_.coverage [/.sharing]
(n.= expected
(/.sharing [a]
- (I64 a)
- expected
-
- (I64 a)
- (.i64 expected)))))
+ (is (I64 a)
+ expected)
+ (is (I64 a)
+ (.i64 expected))))))
(do random.monad
[expected_left random.nat
expected_right random.nat]