diff options
Diffstat (limited to 'stdlib/source/test/aedifex/dependency')
-rw-r--r-- | stdlib/source/test/aedifex/dependency/resolution.lux | 188 |
1 files changed, 102 insertions, 86 deletions
diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index c3e26f5bf..92ced9e74 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -15,7 +15,7 @@ [data ["." product] ["." binary] - ["." text ("#\." equivalence) + ["." text ["." encoding]] [format ["." xml]] @@ -39,7 +39,8 @@ ["#." package (#+ Package)] ["#." hash] ["#." repository (#+ Simulation)] - ["#." dependency] + ["#." dependency + ["#/." status]] ["#." pom] ["#." artifact (#+ Artifact) ["#/." type] @@ -58,33 +59,36 @@ (def: #export (single artifact package) (-> Artifact Package (Simulation Any)) (structure - (def: (on-download request extension state) - (if (\ ///artifact.equivalence = artifact request) - (cond (text\= extension ///artifact/extension.lux-library) - (#try.Success [state (get@ #///package.library package)]) + (def: (on-download uri state) + (if (text.contains? (///artifact.uri artifact) uri) + (cond (text.ends-with? ///artifact/extension.lux-library uri) + (#try.Success [state (|> package + (get@ #///package.library) + product.left)]) - (text\= extension ///artifact/extension.pom) + (text.ends-with? ///artifact/extension.pom uri) (#try.Success [state (|> package (get@ #///package.pom) + product.left (\ xml.codec encode) (\ encoding.utf8 encode))]) + + ## (text.ends-with? ///artifact/extension.sha-1 uri) + ## (#try.Success [state (|> package + ## (get@ #///package.sha-1) + ## (\ ///hash.sha-1-codec encode) + ## (\ encoding.utf8 encode))]) - (text\= extension ///artifact/extension.sha-1) - (#try.Success [state (|> package - (get@ #///package.sha-1) - (\ ///hash.sha-1-codec encode) - (\ encoding.utf8 encode))]) - - (text\= extension ///artifact/extension.md5) - (#try.Success [state (|> package - (get@ #///package.md5) - (\ ///hash.md5-codec encode) - (\ encoding.utf8 encode))]) + ## (text.ends-with? ///artifact/extension.md5 uri) + ## (#try.Success [state (|> package + ## (get@ #///package.md5) + ## (\ ///hash.md5-codec encode) + ## (\ encoding.utf8 encode))]) ## else (#try.Failure "NOPE")) (#try.Failure "NOPE"))) - (def: (on-upload identity artifact extension binary state) + (def: (on-upload uri binary state) (#try.Failure "NOPE")))) (def: one @@ -100,63 +104,69 @@ #let [good (..single expected-artifact expected-package) bad-sha-1 (: (Simulation Any) (structure - (def: (on-download actual-artifact extension state) - (if (\ ///artifact.equivalence = expected-artifact actual-artifact) - (cond (text\= extension ///artifact/extension.lux-library) - (#try.Success [state (get@ #///package.library expected-package)]) + (def: (on-download uri state) + (if (text.contains? (///artifact.uri expected-artifact) uri) + (cond (text.ends-with? ///artifact/extension.lux-library uri) + (#try.Success [state (|> expected-package + (get@ #///package.library) + product.left)]) - (text\= extension ///artifact/extension.pom) + (text.ends-with? ///artifact/extension.pom uri) (#try.Success [state (|> expected-package (get@ #///package.pom) + product.left (\ xml.codec encode) (\ encoding.utf8 encode))]) - (text\= extension ///artifact/extension.sha-1) - (#try.Success [state (|> dummy-package - (get@ #///package.sha-1) - (\ ///hash.sha-1-codec encode) - (\ encoding.utf8 encode))]) + ## (text\= extension ///artifact/extension.sha-1) + ## (#try.Success [state (|> dummy-package + ## (get@ #///package.sha-1) + ## (\ ///hash.sha-1-codec encode) + ## (\ encoding.utf8 encode))]) - (text\= extension ///artifact/extension.md5) - (#try.Success [state (|> expected-package - (get@ #///package.md5) - (\ ///hash.md5-codec encode) - (\ encoding.utf8 encode))]) + ## (text\= extension ///artifact/extension.md5) + ## (#try.Success [state (|> expected-package + ## (get@ #///package.md5) + ## (\ ///hash.md5-codec encode) + ## (\ encoding.utf8 encode))]) ## else (#try.Failure "NOPE")) (#try.Failure "NOPE"))) - (def: (on-upload identity artifact extension binary state) + (def: (on-upload uri binary state) (#try.Failure "NOPE")))) bad-md5 (: (Simulation Any) (structure - (def: (on-download actual-artifact extension state) - (if (\ ///artifact.equivalence = expected-artifact actual-artifact) - (cond (text\= extension ///artifact/extension.lux-library) - (#try.Success [state (get@ #///package.library expected-package)]) + (def: (on-download uri state) + (if (text.contains? (///artifact.uri expected-artifact) uri) + (cond (text.ends-with? ///artifact/extension.lux-library uri) + (#try.Success [state (|> expected-package + (get@ #///package.library) + product.left)]) - (text\= extension ///artifact/extension.pom) + (text.ends-with? ///artifact/extension.pom uri) (#try.Success [state (|> expected-package (get@ #///package.pom) + product.left (\ xml.codec encode) (\ encoding.utf8 encode))]) - (text\= extension ///artifact/extension.sha-1) - (#try.Success [state (|> expected-package - (get@ #///package.sha-1) - (\ ///hash.sha-1-codec encode) - (\ encoding.utf8 encode))]) + ## (text\= extension ///artifact/extension.sha-1) + ## (#try.Success [state (|> expected-package + ## (get@ #///package.sha-1) + ## (\ ///hash.sha-1-codec encode) + ## (\ encoding.utf8 encode))]) - (text\= extension ///artifact/extension.md5) - (#try.Success [state (|> dummy-package - (get@ #///package.md5) - (\ ///hash.md5-codec encode) - (\ encoding.utf8 encode))]) + ## (text\= extension ///artifact/extension.md5) + ## (#try.Success [state (|> dummy-package + ## (get@ #///package.md5) + ## (\ ///hash.md5-codec encode) + ## (\ encoding.utf8 encode))]) ## else (#try.Failure "NOPE")) (#try.Failure "NOPE"))) - (def: (on-upload identity artifact extension binary state) + (def: (on-upload uri binary state) (#try.Failure "NOPE"))))]] (`` ($_ _.and (wrap @@ -205,63 +215,69 @@ #let [good (..single expected-artifact expected-package) bad-sha-1 (: (Simulation Any) (structure - (def: (on-download actual-artifact extension state) - (if (\ ///artifact.equivalence = expected-artifact actual-artifact) - (cond (text\= extension ///artifact/extension.lux-library) - (#try.Success [state (get@ #///package.library expected-package)]) + (def: (on-download uri state) + (if (text.contains? (///artifact.uri expected-artifact) uri) + (cond (text.ends-with? ///artifact/extension.lux-library uri) + (#try.Success [state (|> expected-package + (get@ #///package.library) + product.left)]) - (text\= extension ///artifact/extension.pom) + (text.ends-with? ///artifact/extension.pom uri) (#try.Success [state (|> expected-package (get@ #///package.pom) + product.left (\ xml.codec encode) (\ encoding.utf8 encode))]) - (text\= extension ///artifact/extension.sha-1) - (#try.Success [state (|> dummy-package - (get@ #///package.sha-1) - (\ ///hash.sha-1-codec encode) - (\ encoding.utf8 encode))]) + ## (text\= extension ///artifact/extension.sha-1) + ## (#try.Success [state (|> dummy-package + ## (get@ #///package.sha-1) + ## (\ ///hash.sha-1-codec encode) + ## (\ encoding.utf8 encode))]) - (text\= extension ///artifact/extension.md5) - (#try.Success [state (|> expected-package - (get@ #///package.md5) - (\ ///hash.md5-codec encode) - (\ encoding.utf8 encode))]) + ## (text\= extension ///artifact/extension.md5) + ## (#try.Success [state (|> expected-package + ## (get@ #///package.md5) + ## (\ ///hash.md5-codec encode) + ## (\ encoding.utf8 encode))]) ## else (#try.Failure "NOPE")) (#try.Failure "NOPE"))) - (def: (on-upload identity artifact extension binary state) + (def: (on-upload uri binary state) (#try.Failure "NOPE")))) bad-md5 (: (Simulation Any) (structure - (def: (on-download actual-artifact extension state) - (if (\ ///artifact.equivalence = expected-artifact actual-artifact) - (cond (text\= extension ///artifact/extension.lux-library) - (#try.Success [state (get@ #///package.library expected-package)]) + (def: (on-download uri state) + (if (text.contains? (///artifact.uri expected-artifact) uri) + (cond (text.ends-with? ///artifact/extension.lux-library uri) + (#try.Success [state (|> expected-package + (get@ #///package.library) + product.left)]) - (text\= extension ///artifact/extension.pom) + (text.ends-with? ///artifact/extension.pom uri) (#try.Success [state (|> expected-package (get@ #///package.pom) + product.left (\ xml.codec encode) (\ encoding.utf8 encode))]) - (text\= extension ///artifact/extension.sha-1) - (#try.Success [state (|> expected-package - (get@ #///package.sha-1) - (\ ///hash.sha-1-codec encode) - (\ encoding.utf8 encode))]) + ## (text\= extension ///artifact/extension.sha-1) + ## (#try.Success [state (|> expected-package + ## (get@ #///package.sha-1) + ## (\ ///hash.sha-1-codec encode) + ## (\ encoding.utf8 encode))]) - (text\= extension ///artifact/extension.md5) - (#try.Success [state (|> dummy-package - (get@ #///package.md5) - (\ ///hash.md5-codec encode) - (\ encoding.utf8 encode))]) + ## (text\= extension ///artifact/extension.md5) + ## (#try.Success [state (|> dummy-package + ## (get@ #///package.md5) + ## (\ ///hash.md5-codec encode) + ## (\ encoding.utf8 encode))]) ## else (#try.Failure "NOPE")) (#try.Failure "NOPE"))) - (def: (on-upload identity artifact extension binary state) + (def: (on-upload uri binary state) (#try.Failure "NOPE"))))]] ($_ _.and (wrap @@ -332,9 +348,9 @@ ///pom.write try.assume) - dependee-package (set@ #///package.pom dependee-pom dependee-package) - depender-package (set@ #///package.pom depender-pom depender-package) - ignored-package (set@ #///package.pom ignored-pom ignored-package)]] + dependee-package (set@ #///package.pom [dependee-pom #///dependency/status.Unverified] dependee-package) + depender-package (set@ #///package.pom [depender-pom #///dependency/status.Unverified] depender-package) + ignored-package (set@ #///package.pom [ignored-pom #///dependency/status.Unverified] ignored-package)]] ($_ _.and (wrap (do promise.monad |