diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/test/test/lux/host.js.lux | 32 | ||||
-rw-r--r-- | stdlib/test/test/lux/host.jvm.lux (renamed from stdlib/test/test/lux/host.lux) | 0 |
2 files changed, 32 insertions, 0 deletions
diff --git a/stdlib/test/test/lux/host.js.lux b/stdlib/test/test/lux/host.js.lux new file mode 100644 index 000000000..4c2b55485 --- /dev/null +++ b/stdlib/test/test/lux/host.js.lux @@ -0,0 +1,32 @@ +(;module: + lux + (lux [io] + (control monad) + (data text/format) + ["&" host] + ["R" random] + pipe) + lux/test) + +(test: "JavaScript operations" + ($_ seq + (assert "Null equals itself." + (is (&;null) (&;null))) + + (assert "Undefined equals itself." + (is (&;undef) (&;undef))) + + (assert "Can reference JavaScript objects." + (is (&;ref "Math") (&;ref "Math"))) + + (assert "Can create objects and access their fields." + (|> (&;object "foo" "BAR") + (&;get "foo" Text) + (is "BAR"))) + + (assert "Can call JavaScript functions" + (and (is 124.0 + (&;call! (&;ref "Math.ceil" &;Function) [123.45] Real)) + (is 124.0 + (&;call! (&;ref "Math") "ceil" [123.45] Real)))) + )) diff --git a/stdlib/test/test/lux/host.lux b/stdlib/test/test/lux/host.jvm.lux index 54e6cf4b9..54e6cf4b9 100644 --- a/stdlib/test/test/lux/host.lux +++ b/stdlib/test/test/lux/host.jvm.lux |