aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/ffi/node_js.js.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/ffi/node_js.js.lux')
-rw-r--r--stdlib/source/test/lux/ffi/node_js.js.lux42
1 files changed, 42 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/ffi/node_js.js.lux b/stdlib/source/test/lux/ffi/node_js.js.lux
new file mode 100644
index 000000000..82aff3f75
--- /dev/null
+++ b/stdlib/source/test/lux/ffi/node_js.js.lux
@@ -0,0 +1,42 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]]
+ [control
+ ["[0]" try]
+ ["[0]" exception]]
+ [math
+ ["[0]" random]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]])
+
+(def .public test
+ Test
+ (do [! random.monad]
+ [real_module (all random.either
+ (in "buffer")
+ (in "fs")
+ (in "net")
+ (in "os"))
+ fake_module (random.upper_case 1)]
+ (<| (_.covering /._)
+ (all _.and
+ (_.coverage [/.require]
+ (when [(/.require real_module)
+ (/.require real_module)]
+ [{try.#Success left} {try.#Success right}]
+ (same? left right)
+
+ _
+ false))
+ (_.coverage [/.cannot_require]
+ (when (/.require fake_module)
+ {try.#Failure error}
+ (exception.match? /.cannot_require error)
+
+ _
+ false))
+ ))))