aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex
diff options
context:
space:
mode:
authorEduardo Julian2021-07-18 23:10:18 -0400
committerEduardo Julian2021-07-18 23:10:18 -0400
commita40f40f230e6312ae432f06e7f73aa5945d8fa49 (patch)
tree5005ef744b01f9327c2e4df23146928f1723c495 /stdlib/source/test/aedifex
parent442d1557b879a8a4bd76f441f72a17bfb71cf05f (diff)
New JVM compiler can now compile JVM interfaces.
Diffstat (limited to 'stdlib/source/test/aedifex')
-rw-r--r--stdlib/source/test/aedifex/metadata/artifact.lux84
-rw-r--r--stdlib/source/test/aedifex/metadata/snapshot.lux71
-rw-r--r--stdlib/source/test/aedifex/pom.lux49
-rw-r--r--stdlib/source/test/aedifex/project.lux4
4 files changed, 151 insertions, 57 deletions
diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux
index 5e5f67bec..5ba4bdbe4 100644
--- a/stdlib/source/test/aedifex/metadata/artifact.lux
+++ b/stdlib/source/test/aedifex/metadata/artifact.lux
@@ -9,8 +9,19 @@
[control
["." try ("#\." functor)]
[parser
- ["<.>" xml]]]
+ ["." environment]
+ ["<.>" xml]]
+ [concurrency
+ ["." promise]]]
+ [data
+ ["." maybe]
+ ["." text ("#\." equivalence)]
+ [collection
+ ["." list]]]
+ [macro
+ ["." code]]
[math
+ ["." random (#+ Random)]
[number
["n" nat]]]
["." time
@@ -19,12 +30,16 @@
["." month]
["." instant]
["." duration]]
- [math
- ["." random (#+ Random)]]
- [macro
- ["." code]]]]
+ [world
+ ["." file]
+ ["." program]]]]
[\\program
- ["." /]])
+ ["." /
+ ["/#" //
+ ["/#" // #_
+ ["#." artifact]
+ ["#." repository #_
+ ["#/." local]]]]]])
(def: #export random
(Random /.Metadata)
@@ -55,16 +70,47 @@
Test
(<| (_.covering /._)
(_.for [/.Metadata])
- ($_ _.and
- (_.for [/.equivalence]
- ($equivalence.spec /.equivalence ..random))
- (do random.monad
- [expected ..random]
- (_.cover [/.format /.parser]
- (|> expected
- /.format
- list
- (<xml>.run /.parser)
- (try\map (\ /.equivalence = expected))
- (try.default false))))
- )))
+ (do random.monad
+ [expected ..random
+ #let [artifact {#///artifact.group (get@ #/.group expected)
+ #///artifact.name (get@ #/.name expected)
+ #///artifact.version (|> expected
+ (get@ #/.versions)
+ list.head
+ (maybe.default ""))}]]
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+
+ (do random.monad
+ [expected ..random]
+ (_.cover [/.format /.parser]
+ (|> expected
+ /.format
+ list
+ (<xml>.run /.parser)
+ (try\map (\ /.equivalence = expected))
+ (try.default false))))
+ (_.cover [/.uri]
+ (text\= (//.remote_project_uri artifact)
+ (/.uri artifact)))
+ (do random.monad
+ [home (random.ascii/lower 5)
+ working_directory (random.ascii/lower 5)
+ #let [program (program.async (program.mock environment.empty home working_directory))
+ fs (file.mock (\ file.default separator))
+ repository (///repository/local.repository program fs)]]
+ (wrap (do promise.monad
+ [wrote? (/.write repository artifact expected)
+ actual (/.read repository artifact)]
+ (_.cover' [/.write /.read]
+ (and (case wrote?
+ (#try.Success _) true
+ (#try.Failure _) false)
+ (case actual
+ (#try.Success actual)
+ (\ /.equivalence = expected actual)
+
+ (#try.Failure _)
+ false))))))
+ ))))
diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux
index 5a821c452..431370048 100644
--- a/stdlib/source/test/aedifex/metadata/snapshot.lux
+++ b/stdlib/source/test/aedifex/metadata/snapshot.lux
@@ -9,8 +9,19 @@
[control
["." try ("#\." functor)]
[parser
- ["<.>" xml]]]
+ ["." environment]
+ ["<.>" xml]]
+ [concurrency
+ ["." promise]]]
+ [data
+ ["." maybe]
+ ["." text ("#\." equivalence)]
+ [collection
+ ["." list]]]
+ [macro
+ ["." code]]
[math
+ ["." random (#+ Random) ("#\." monad)]
[number
["n" nat]]]
["." time
@@ -19,10 +30,9 @@
["." month]
["." instant (#+ Instant)]
["." duration]]
- [math
- ["." random (#+ Random) ("#\." monad)]]
- [macro
- ["." code]]]]
+ [world
+ ["." file]
+ ["." program]]]]
["$." /// #_
["#." artifact
["#/." type]
@@ -31,10 +41,13 @@
["#/." version]]]]
[\\program
["." /
- [///
- [artifact
- [versioning (#+ Versioning)]
- ["#." snapshot]]]]])
+ ["/#" //
+ ["/#" // #_
+ [artifact
+ [versioning (#+ Versioning)]
+ ["#." snapshot]]
+ ["#." repository #_
+ ["#/." local]]]]]])
(def: random_instant
(Random Instant)
@@ -60,7 +73,7 @@
(def: random_versioning
(Random Versioning)
($_ random.and
- (random\wrap #/snapshot.Local)
+ (random\wrap #///snapshot.Local)
$///artifact/time.random
(random.list 5 $///artifact/snapshot/version.random)
))
@@ -76,16 +89,40 @@
Test
(<| (_.covering /._)
(_.for [/.Metadata])
- ($_ _.and
- (_.for [/.equivalence]
- ($equivalence.spec /.equivalence ..random))
- (do random.monad
- [expected ..random]
+ (do random.monad
+ [expected ..random
+ #let [artifact (get@ #/.artifact expected)]]
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence ..random))
+
(_.cover [/.format /.parser]
(|> expected
/.format
list
(<xml>.run /.parser)
(try\map (\ /.equivalence = expected))
- (try.default false))))
- )))
+ (try.default false)))
+ (_.cover [/.uri]
+ (text\= (//.remote_artifact_uri artifact)
+ (/.uri artifact)))
+ (do random.monad
+ [home (random.ascii/lower 5)
+ working_directory (random.ascii/lower 5)
+ #let [program (program.async (program.mock environment.empty home working_directory))
+ fs (file.mock (\ file.default separator))
+ repository (///repository/local.repository program fs)]]
+ (wrap (do promise.monad
+ [wrote? (/.write repository artifact expected)
+ actual (/.read repository artifact)]
+ (_.cover' [/.write /.read]
+ (and (case wrote?
+ (#try.Success _) true
+ (#try.Failure _) false)
+ (case actual
+ (#try.Success actual)
+ (\ /.equivalence = expected actual)
+
+ (#try.Failure _)
+ false))))))
+ ))))
diff --git a/stdlib/source/test/aedifex/pom.lux b/stdlib/source/test/aedifex/pom.lux
index 24ca3c3c6..01b90c33e 100644
--- a/stdlib/source/test/aedifex/pom.lux
+++ b/stdlib/source/test/aedifex/pom.lux
@@ -10,6 +10,7 @@
["<>" parser
["<.>" xml]]]
[data
+ ["." text ("#\." equivalence)]
[format
["." xml]]]
[math
@@ -24,27 +25,33 @@
(def: #export test
Test
(<| (_.covering /._)
- (do random.monad
- [expected @profile.random]
- (_.cover [/.write /.parser]
- (case [(/.write expected)
- (get@ #//.identity expected)]
- [(#try.Success pom)
- (#.Some _)]
- (case (<xml>.run /.parser (list pom))
- (#try.Success actual)
- (\ //.equivalence =
- (|> (\ //.monoid identity)
- (set@ #//.dependencies (get@ #//.dependencies expected))
- (set@ #//.repositories (get@ #//.repositories expected)))
- actual)
+ ($_ _.and
+ (_.cover [/.file]
+ (|> /.file
+ (text\= "")
+ not))
+ (do random.monad
+ [expected @profile.random]
+ (_.cover [/.write /.parser]
+ (case [(/.write expected)
+ (get@ #//.identity expected)]
+ [(#try.Success pom)
+ (#.Some _)]
+ (case (<xml>.run /.parser (list pom))
+ (#try.Success actual)
+ (\ //.equivalence =
+ (|> (\ //.monoid identity)
+ (set@ #//.dependencies (get@ #//.dependencies expected))
+ (set@ #//.repositories (get@ #//.repositories expected)))
+ actual)
- (#try.Failure error)
- false)
+ (#try.Failure error)
+ false)
- [(#try.Failure error)
- #.None]
- (exception.match? //.no_identity error)
+ [(#try.Failure error)
+ #.None]
+ (exception.match? //.no_identity error)
- _
- false)))))
+ _
+ false)))
+ )))
diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux
index bdeee7993..5b6de5403 100644
--- a/stdlib/source/test/aedifex/project.lux
+++ b/stdlib/source/test/aedifex/project.lux
@@ -46,6 +46,10 @@
(_.for [/.monoid]
($monoid.spec /.equivalence /.monoid ..random))
+ (_.cover [/.file]
+ (|> /.file
+ (text\= "")
+ not))
(do random.monad
[[super_name super_profile] ..profile
[dummy_name dummy_profile] (random.filter (|>> product.left (text\= super_name) not)