aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/ffi.jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/ffi.jvm.lux38
1 files changed, 35 insertions, 3 deletions
diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux
index 96da12763..e2d7e4f4d 100644
--- a/stdlib/source/test/lux/ffi.jvm.lux
+++ b/stdlib/source/test/lux/ffi.jvm.lux
@@ -12,12 +12,14 @@
["." exception]]
[data
["." bit ("#\." equivalence)]
- ["." text ("#\." equivalence)]
+ ["." text ("#\." equivalence)
+ ["%" format (#+ format)]]
[collection
["." array (#+ Array)]]]
["." macro
[syntax (#+ syntax:)]
- ["." code]]
+ ["." code]
+ ["." template]]
[math
["." random (#+ Random)]
[number
@@ -119,7 +121,7 @@
(i.= (:as Int value))))
(_.cover [/.cannot_convert_to_jvm_type]
(let [array (:as (Array Nothing)
- (array.new 1))]
+ (array.empty 1))]
(|> array
/.array_length
..macro_error
@@ -571,6 +573,35 @@
example/9!)
)))
+(syntax: (expands? expression)
+ (function (_ lux)
+ (|> (macro.single_expansion expression)
+ (meta.run lux)
+ (case> (#try.Success expansion)
+ true
+
+ (#try.Failure error)
+ false)
+ code.bit
+ list
+ [lux]
+ #try.Success)))
+
+(def: for_exception
+ Test
+ ($_ _.and
+ (_.cover [/.class_names_cannot_contain_periods]
+ (with_expansions [<class> (template.identifier ["java.lang.Float"])]
+ (not (expands? (/.import: <class>)))))
+ (_.cover [/.class_name_cannot_be_a_type_variable]
+ (and (not (expands? (/.import: (java/lang/Double a)
+ ["#::."
+ (invalid [] (a java/lang/String))])))
+ (not (expands? (/.import: java/lang/Double
+ ["#::."
+ ([a] invalid [] (a java/lang/String))])))))
+ ))
+
(def: #export test
(<| (_.covering /._)
($_ _.and
@@ -579,4 +610,5 @@
..for_miscellaneous
..for_interface
..for_class
+ ..for_exception
)))