aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/meta/symbol.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/meta/symbol.lux')
-rw-r--r--stdlib/source/test/lux/meta/symbol.lux28
1 files changed, 21 insertions, 7 deletions
diff --git a/stdlib/source/test/lux/meta/symbol.lux b/stdlib/source/test/lux/meta/symbol.lux
index f7c2d7db4..b6aca8568 100644
--- a/stdlib/source/test/lux/meta/symbol.lux
+++ b/stdlib/source/test/lux/meta/symbol.lux
@@ -29,10 +29,26 @@
["[0]" /]])
(def .public (random module_size short_size)
- (-> Nat Nat (Random Symbol))
+ (-> Nat Nat
+ (Random Symbol))
(random.and (random.alphabetic module_size)
(random.alphabetic short_size)))
+(def .public (relative module short_size)
+ (-> Text Nat
+ (Random Symbol))
+ (do [! random.monad]
+ [relative? random.bit
+ short (random.alphabetic short_size)]
+ (if relative?
+ (do !
+ [in_prelude? random.bit]
+ (in [(if in_prelude?
+ .prelude
+ "")
+ short]))
+ (in [module short]))))
+
(def .public test
Test
(<| (_.covering /._)
@@ -56,11 +72,9 @@
(_.for [/.order]
(orderT.spec /.order (..random sizeM1 sizeS1)))
(_.for [/.absolute]
- (_.and (codecT.spec /.equivalence /.absolute (..random sizeM1 sizeS1))
- (_.test "Encoding a symbol without a module component results in text equal to the short of the symbol."
- (if (text.empty? module1)
- (same? short1 (of /.absolute encoded symbol1))
- true))))
+ (codecT.spec /.equivalence /.absolute (..relative module1 sizeS1)))
+ (_.for [/.relative]
+ (codecT.spec /.equivalence (/.relative module1) (..relative module1 sizeS1)))
(_.coverage [/.separator]
(let [it (of /.absolute encoded symbol1)]
@@ -73,7 +87,7 @@
(_.for [.symbol]
(let [(open "/#[0]") /.equivalence]
(all _.and
- (_.test "Can obtain Symbol from a symbol."
+ (_.test "Can obtain a Symbol from a symbol."
(and (/#= [.prelude "yolo"] (.symbol .yolo))
(/#= ["test/lux/meta/symbol" "yolo"] (.symbol ..yolo))
(/#= ["" "yolo"] (.symbol yolo))