aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/artifact/versioning.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-01-11 02:05:30 -0400
committerEduardo Julian2021-01-11 02:05:30 -0400
commit8aac0c573c29d2829242d66539a9e027d03ff8ec (patch)
tree5b4b37d33b90ff24b3d9d019e31770d6d0b8dc9d /stdlib/source/test/aedifex/artifact/versioning.lux
parent706ce9e4916b65c4df5101bd3cc1b4da3b2057af (diff)
Encapsulate JS definitions produced by the JS compiler in a local scope to avoid interacting with the global scope.
Diffstat (limited to 'stdlib/source/test/aedifex/artifact/versioning.lux')
-rw-r--r--stdlib/source/test/aedifex/artifact/versioning.lux43
1 files changed, 43 insertions, 0 deletions
diff --git a/stdlib/source/test/aedifex/artifact/versioning.lux b/stdlib/source/test/aedifex/artifact/versioning.lux
new file mode 100644
index 000000000..c0704440e
--- /dev/null
+++ b/stdlib/source/test/aedifex/artifact/versioning.lux
@@ -0,0 +1,43 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]
+ {[0 #spec]
+ [/
+ ["$." equivalence]]}]
+ [control
+ ["." try ("#\." functor)]
+ [parser
+ ["<.>" xml]]]
+ [math
+ ["." random (#+ Random)]]]
+ {#program
+ ["." /]})
+
+(def: #export random
+ (Random /.Versioning)
+ ($_ random.and
+ random.instant
+ random.nat
+ (random.list 5 (random.ascii/lower_alpha 3))
+ ))
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.Versioning])
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+
+ (do random.monad
+ [expected ..random
+ version (random.ascii/upper_alpha 3)]
+ (_.cover [/.format /.parser]
+ (|> expected
+ (/.format version)
+ (<xml>.run (/.parser version))
+ (try\map (\ /.equivalence = expected))
+ (try.default false))))
+ )))