aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/meta/macro/syntax/export.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/meta/macro/syntax/export.lux')
-rw-r--r--stdlib/source/test/lux/meta/macro/syntax/export.lux46
1 files changed, 46 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/meta/macro/syntax/export.lux b/stdlib/source/test/lux/meta/macro/syntax/export.lux
new file mode 100644
index 000000000..bace31485
--- /dev/null
+++ b/stdlib/source/test/lux/meta/macro/syntax/export.lux
@@ -0,0 +1,46 @@
+(.require
+ [library
+ [lux (.except)
+ ["_" test (.only Test)]
+ [abstract
+ [monad (.only do)]]
+ [control
+ ["[0]" maybe]
+ ["[0]" try (.use "[1]#[0]" functor)]]
+ [math
+ ["[0]" random (.only Random)]
+ [number
+ ["n" nat]]]
+ [meta
+ ["[0]" code (.use "[1]#[0]" equivalence)
+ ["<[1]>" \\parser]]]]]
+ [\\library
+ ["[0]" /]])
+
+(def export
+ (Random [(Maybe Code) Nat])
+ (all random.and
+ (|> random.bit
+ (at random.monad each code.bit)
+ random.maybe)
+ random.nat))
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do random.monad
+ [[expected_export_policy expected_un_exported] ..export]
+ (_.coverage [/.parser /.default_policy]
+ (|> (case expected_export_policy
+ {.#Some expected_export_policy}
+ (list expected_export_policy (code.nat expected_un_exported))
+
+ {.#None}
+ (list (code.nat expected_un_exported)))
+ (<code>.result (/.parser <code>.nat))
+ (try#each (function (_ [actual_export_policy actual_un_exported])
+ (|> expected_export_policy
+ (maybe.else /.default_policy)
+ (code#= actual_export_policy)
+ (and (n.= expected_un_exported actual_un_exported)))))
+ (try.else false))))))