aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux.lux')
-rw-r--r--stdlib/source/test/lux.lux37
1 files changed, 35 insertions, 2 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 1e9976f4e..dffa24069 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -277,16 +277,20 @@
false))
)))
-(interface: (Returner a)
+(/.interface: (Returner a)
(: (-> Any a)
return))
-(implementation: (global_returner value)
+(/.implementation: (global_returner value)
(All [a] (-> a (Returner a)))
(def: (return _)
value))
+(def: static_return 123)
+
+(/.open: "global\." (..global_returner ..static_return))
+
(def: for_interface
Test
(do random.monad
@@ -301,6 +305,13 @@
(n.= expected (\ (global_returner expected) return [])))
(_.cover [/.implementation]
(n.= expected (\ local_returner return [])))
+ (_.cover [/.open:]
+ (n.= static_return (global\return [])))
+ (_.cover [/.^open]
+ (let [(/.^open "local\.") local_returner]
+ (n.= expected (local\return []))))
+ (_.cover [/.\]
+ (n.= expected (/.\ local_returner return [])))
))))
(def: for_module
@@ -587,6 +598,27 @@
false)))
)))
+(def: option/0 "0")
+(def: option/1 "1")
+(def: static_char "@")
+
+(def: for_static
+ Test
+ (do random.monad
+ [sample (random.either (wrap option/0)
+ (wrap option/1))]
+ ($_ _.and
+ (_.cover [/.static]
+ (case sample
+ (^ (/.static option/0)) true
+ (^ (/.static option/1)) true
+ _ false))
+ (_.cover [/.char]
+ (|> (`` (/.char (~~ (/.static static_char))))
+ text.from_code
+ (text\= static_char)))
+ )))
+
(def: test
Test
(<| (_.covering /._)
@@ -612,6 +644,7 @@
..for_i64
..for_function
..for_template
+ ..for_static
..sub_tests
)))