aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-07-22 01:16:40 -0400
committerEduardo Julian2021-07-22 01:16:40 -0400
commit51a5c28b0f9efd514e3fae7c2634fd5e9bd714e2 (patch)
treecbd24da4230577ef5bbf66161cb825216d924ba5 /stdlib/source/test/lux.lux
parent461a6ce673de9b2c3d77714c4884c2a316fe7e8f (diff)
New JVM compiler can now compile JVM classes.
Diffstat (limited to 'stdlib/source/test/lux.lux')
-rw-r--r--stdlib/source/test/lux.lux80
1 files changed, 42 insertions, 38 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index cbc63d90d..20d21d74d 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -93,40 +93,6 @@
value)))))
))
-(template: (quadrance cat0 cat1)
- (n.+ (n.* cat0 cat0) (n.* cat1 cat1)))
-
-(def: templates
- Test
- (do random.monad
- [cat0 random.nat
- cat1 random.nat]
- (_.test "Template application is a stand-in for the templated code."
- (n.= (n.+ (n.* cat0 cat0) (n.* cat1 cat1))
- (quadrance cat0 cat1)))))
-
-(def: cross_platform_support
- Test
- (do random.monad
- [on_default random.nat
- on_fake_host random.nat
- on_valid_host random.nat]
- ($_ _.and
- (_.test "Can provide default in case there is no particular host/platform support."
- (n.= on_default
- (for {"" on_fake_host}
- on_default)))
- (_.test "Can pick code depending on the host/platform being targeted."
- (n.= on_valid_host
- (for {@.old on_valid_host
- @.jvm on_valid_host
- @.js on_valid_host
- @.python on_valid_host
- @.lua on_valid_host
- @.ruby on_valid_host
- @.php on_valid_host}
- on_default))))))
-
(def: sub_tests
Test
(with_expansions [## TODO: Update & expand tests for this
@@ -732,6 +698,47 @@
(not (code\= (' <left_association>)
(' <right_association>))))))))
+(def: for_expansion
+ Test
+ (do random.monad
+ [left random.nat
+ right random.nat
+ dummy random.nat
+ #let [expected (n.+ left right)]]
+ ($_ _.and
+ (_.cover [/.as_is]
+ (`` (and (~~ (as_is true
+ true
+ true)))))
+ (_.cover [/.with_expansions]
+ (/.with_expansions [<operands> (as_is left right)]
+ (n.= expected
+ (n.+ <operands>))))
+ (_.cover [/.comment]
+ (/.with_expansions [<dummy> (/.comment dummy)
+ <operands> (as_is left right)]
+ (n.= expected
+ ($_ n.+ <operands> <dummy>))))
+ (_.cover [/.``]
+ (n.= expected
+ (/.`` ($_ n.+
+ (~~ (as_is left right))
+ (~~ (/.comment dummy))))))
+ (_.cover [/.for]
+ (and (n.= expected
+ (/.for {"fake host" dummy}
+ expected))
+ (n.= expected
+ (/.for {@.old expected
+ @.jvm expected
+ @.js expected
+ @.python expected
+ @.lua expected
+ @.ruby expected
+ @.php expected}
+ dummy))))
+ )))
+
(def: test
Test
(<| (_.covering /._)
@@ -740,10 +747,6 @@
..identity)
(<| (_.context "Prelude macros.")
..prelude_macros)
- (<| (_.context "Templates.")
- ..templates)
- (<| (_.context "Cross-platform support.")
- ..cross_platform_support)
..for_bit
..for_try
@@ -760,6 +763,7 @@
..for_static
..for_slot
..for_associative
+ ..for_expansion
..sub_tests
)))