aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/aedifex')
-rw-r--r--stdlib/source/test/aedifex/command/pom.lux67
-rw-r--r--stdlib/source/test/aedifex/parser.lux12
2 files changed, 73 insertions, 6 deletions
diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux
new file mode 100644
index 000000000..1bb098de0
--- /dev/null
+++ b/stdlib/source/test/aedifex/command/pom.lux
@@ -0,0 +1,67 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." try (#+ Try) ("#@." functor)]
+ [concurrency
+ ["." promise (#+ Promise)]]
+ [security
+ ["!" capability]]]
+ [data
+ ["." binary]
+ ["." text ("#@." equivalence)
+ ["." encoding]]
+ [format
+ ["." xml]]]
+ [math
+ ["." random (#+ Random)]]
+ [world
+ ["." file (#+ File)]]]
+ [///
+ ["@." profile]]
+ {#program
+ ["." /
+ ["//#" /// #_
+ ["#" profile]
+ ["#." action]
+ ["#." pom]]]})
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (do random.monad
+ [sample @profile.random
+ #let [fs (file.mock (:: file.system separator))]]
+ (wrap (do {@ promise.monad}
+ [outcome (/.do! fs sample)]
+ (case outcome
+ (#try.Success path)
+ (do @
+ [verdict (do ///action.monad
+ [expected (|> (///pom.write sample)
+ (try@map (|>> (:: xml.codec encode) encoding.to-utf8))
+ (:: @ wrap))
+ file (: (Promise (Try (File Promise)))
+ (file.get-file promise.monad fs path))
+ actual (!.use (:: file content) [])
+
+ #let [expected-path!
+ (text@= ///pom.file path)
+
+ expected-content!
+ (:: binary.equivalence = expected actual)]]
+ (wrap (and expected-path!
+ expected-content!)))]
+ (_.claim [/.do!]
+ (try.default false verdict)))
+
+ (#try.Failure error)
+ (_.claim [/.do!]
+ (case (get@ #///.identity sample)
+ (#.Some _)
+ false
+
+ #.None
+ true))))))))
diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux
index a171e694d..0c85156d2 100644
--- a/stdlib/source/test/aedifex/parser.lux
+++ b/stdlib/source/test/aedifex/parser.lux
@@ -22,7 +22,7 @@
[macro
["." code]]]
[//
- ["_." profile]]
+ ["@." profile]]
{#program
["." /
["/#" // #_
@@ -48,9 +48,9 @@
(dictionary.from-list key-hash)
(..list-of (random.and key-random value-random))))
-(def: project
+(def: random
(Random Project)
- (..dictionary-of text.hash ..name _profile.random))
+ (..dictionary-of text.hash ..name @profile.random))
(def: with-default-sources
(-> //.Profile //.Profile)
@@ -64,7 +64,7 @@
(def: single-profile
Test
(do random.monad
- [expected _profile.random]
+ [expected @profile.random]
(_.test "Single profile."
(|> expected
//format.profile
@@ -88,7 +88,7 @@
(def: multiple-profiles
Test
(do random.monad
- [expected ..project]
+ [expected ..random]
(_.test "Multiple profiles."
(|> expected
//format.project
@@ -100,7 +100,7 @@
dictionary.entries
(list@map (function (_ [name profile])
[name (..with-default-sources profile)]))
- (dictionary.from-list text.hash)
+ (dictionary.from-list text.hash)
(:: //project.equivalence = actual))
(#try.Failure error)