aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux.lux15
-rw-r--r--stdlib/source/test/lux/ffi.jvm.lux59
-rw-r--r--stdlib/source/test/lux/ffi/export.jvm.lux18
3 files changed, 75 insertions, 17 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index ad0f5fc95..a43e6a889 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -47,18 +47,22 @@
["[1][0]" control]
["[1][0]" data]
["[1][0]" debug]
+
["[1][0]" documentation]
["[1][0]" locale]
["[1][0]" macro]
["[1][0]" math]
+
["[1][0]" meta]
["[1][0]" program]
["[1][0]" static]
["[1][0]" test]
+
["[1][0]" time]
["[1][0]" tool]
["[1][0]" type]
["[1][0]" world]
+
["[1][0]" ffi]
["[1][0]" extension]
["[1][0]" target (.only)
@@ -68,7 +72,8 @@
"Lua" (~~ (.these ["[1]/[0]" lua]))
"Python" (~~ (.these ["[1]/[0]" python]))
"Ruby" (~~ (.these ["[1]/[0]" ruby]))
- (~~ (.these))))]])))
+ (~~ (.these))))]
+ ])))
(def: for_bit
Test
@@ -1217,18 +1222,18 @@
/meta.test
/program.test
/static.test
- /target.test
-
/test.test
+
/time.test
/tool.test
/type.test
-
/world.test
+
/ffi.test
-
(~~ (for @.old (~~ (these))
(~~ (these /extension.test))))
+
+ /target.test
(~~ (for @.jvm (~~ (these /target/jvm.test))
@.old (~~ (these /target/jvm.test))
@.js (~~ (these /target/js.test))
diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux
index 146fb5683..d30eee0ae 100644
--- a/stdlib/source/test/lux/ffi.jvm.lux
+++ b/stdlib/source/test/lux/ffi.jvm.lux
@@ -9,6 +9,7 @@
[abstract
[monad (.only do)]]
[control
+ ["[0]" io]
["[0]" pipe]
["[0]" try (.open: "[1]#[0]" functor)]
["[0]" exception]
@@ -526,6 +527,30 @@
(set_actual9 [a] void)
(get_actual9 [] a))
+(/.class: "final" (test/TestClass10 a) []
+ ... Fields
+ ("public" value10 a)
+ ... Constructors
+ ("public" [] (new self [init a]) []
+ (:= ::value10 init)))
+
+(/.import (test/TestClass10 a)
+ "[1]::[0]"
+ (new [a])
+ (value10 a))
+
+(/.class: "final" (test/TestClass11 a) []
+ ... Fields
+ ("public" value11 a)
+ ... Constructors
+ ("public" [] (new self [init a]) []
+ (:= ::value11 init)))
+
+(/.import (test/TestClass11 a)
+ "[1]::[0]"
+ (new [a])
+ ("read_only" value11 a))
+
(def: for_class
Test
(do [! random.monad]
@@ -595,12 +620,36 @@
(test/TestClass9::new dummy/0))
(test/TestClass9::set_actual9 dummy/1)
(test/TestClass9::set_actual9 dummy/2))
-
example/9!
(|> object/9
test/TestClass9::get_actual9
/.as_long
- (same? dummy/2))]]
+ (same? dummy/2))
+
+ object/10 (is (test/TestClass10 java/lang/Long)
+ (test/TestClass10::new dummy/0))
+ example/10!
+ (and (|> object/10
+ test/TestClass10::value10
+ io.run!
+ (same? dummy/0))
+ (|> object/10
+ (test/TestClass10::value10 dummy/1)
+ io.run!
+ test/TestClass10::value10
+ io.run!
+ (same? dummy/1)))
+
+ object/11 (is (test/TestClass11 java/lang/Long)
+ (test/TestClass11::new dummy/0))
+ example/11!
+ (and (|> object/11
+ test/TestClass11::value11
+ (same? dummy/0))
+ (|> object/11
+ (test/TestClass11::value11 dummy/1)
+ macro_error
+ (text.contains? (the exception.#label /.cannot_write_to_field))))]]
(all _.and
(_.coverage [/.class: /.import]
(and example/0!
@@ -610,7 +659,11 @@
example/4!
example/5!
example/7!
- example_8!))
+ example_8!
+ example/10!
+ ))
+ (_.coverage [/.cannot_write_to_field]
+ example/11!)
(_.coverage [/.do_to]
example/9!)
)))
diff --git a/stdlib/source/test/lux/ffi/export.jvm.lux b/stdlib/source/test/lux/ffi/export.jvm.lux
index c3fd80bea..e9468a8fe 100644
--- a/stdlib/source/test/lux/ffi/export.jvm.lux
+++ b/stdlib/source/test/lux/ffi/export.jvm.lux
@@ -68,14 +68,14 @@
(`` (`` (//.import Primitives
"[1]::[0]"
- ("static" actual_boolean boolean)
- ("static" actual_byte byte)
- ("static" actual_short short)
- ("static" actual_int int)
- ("static" actual_long long)
- ("static" actual_char char)
- ("static" actual_float float)
- ("static" actual_double double)
+ ("read_only" "static" actual_boolean boolean)
+ ("read_only" "static" actual_byte byte)
+ ("read_only" "static" actual_short short)
+ ("read_only" "static" actual_int int)
+ ("read_only" "static" actual_long long)
+ ("read_only" "static" actual_char char)
+ ("read_only" "static" actual_float float)
+ ("read_only" "static" actual_double double)
(~~ (with_template [<type>]
[("static" (~~ (template.symbol [<type> "_method"])) [<type> <type>] <type>)]
@@ -103,7 +103,7 @@
(//.import Objects
"[1]::[0]"
- ("static" actual_string java/lang/String)
+ ("read_only" "static" actual_string java/lang/String)
("static" string_method [java/lang/String java/lang/String] java/lang/String)