From abe24425ced15fd784ef6c62d6f186af72b491db Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 11 Jul 2021 01:51:04 -0400 Subject: Re-named ":coerce" to ":as" since it technically doesn't do coercions. --- stdlib/source/test/aedifex/command/install.lux | 9 +++-- stdlib/source/test/aedifex/profile.lux | 1 + stdlib/source/test/aedifex/repository.lux | 2 + stdlib/source/test/aedifex/repository/local.lux | 51 +++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 stdlib/source/test/aedifex/repository/local.lux (limited to 'stdlib/source/test/aedifex') diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index 5800bca6d..0e8a95526 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -67,10 +67,11 @@ sample (\ ! map (set@ #///.identity (#.Some identity)) $profile.random) home (random.ascii/alpha 5) - working_directory (random.ascii/alpha 5)] + working_directory (random.ascii/alpha 5) + #let [/ (\ file.default separator)]] ($_ _.and (wrap (do {! promise.monad} - [#let [fs (file.mock (\ file.default separator)) + [#let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory)) artifact_path (///local.uri (get@ #///artifact.version identity) identity) @@ -80,9 +81,11 @@ [succeeded! (\ ! map (text\= /.success) (..execute! program fs sample)) library_exists! (|> library_path + (format home /) (\ fs file?) (\ promise.monad map exception.return)) pom_exists! (|> pom_path + (format home /) (\ fs file?) (\ promise.monad map exception.return))] (wrap (and succeeded! @@ -91,7 +94,7 @@ (_.cover' [/.do! /.success] (try.default false verdict)))) (wrap (do {! promise.monad} - [#let [fs (file.mock (\ file.default separator)) + [#let [fs (file.mock /) program (program.async (program.mock environment.empty home working_directory))] logging (..execute! program fs (set@ #///.identity #.None sample))] (_.cover' [/.failure] diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux index 3410255f5..0a0ba8642 100644 --- a/stdlib/source/test/aedifex/profile.lux +++ b/stdlib/source/test/aedifex/profile.lux @@ -124,6 +124,7 @@ (random.maybe ..info) (..set_of text.hash ..repository) (..set_of //dependency.hash @dependency.random) + @dependency.random (..set_of text.hash ..source) ..target (random.maybe (random.ascii/alpha 1)) diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index d16734a60..f9a4eeda6 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -24,6 +24,7 @@ ["." / #_ ["#." identity] ["#." origin] + ["#." local] ["#." remote] [// ["@." artifact]]] @@ -100,5 +101,6 @@ /identity.test /origin.test + /local.test /remote.test ))) diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux new file mode 100644 index 000000000..946494437 --- /dev/null +++ b/stdlib/source/test/aedifex/repository/local.lux @@ -0,0 +1,51 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] + [control + ["." try ("#\." functor)] + [parser + ["." environment]] + [concurrency + ["." promise]]] + [data + ["." binary ("#\." equivalence)] + [text + [encoding + ["." utf8]]]] + [math + ["." random]] + [world + ["." file] + ["." program]]] + {#program + ["." /]}) + +(def: #export test + Test + (<| (_.covering /._) + (do {! random.monad} + [/ (random.ascii/upper 1) + home (random.ascii/lower 10) + working_directory (random.ascii/lower 10) + #let [fs (file.mock /) + program (program.async (program.mock environment.empty home working_directory)) + repo (/.repository program fs)] + + uri (random.ascii/lower 10) + expected (\ ! map (\ utf8.codec encode) + (random.ascii/lower 10))] + ($_ _.and + (wrap (do promise.monad + [before_upload (\ repo download uri) + _ (\ repo upload uri expected) + actual (\ repo download uri)] + (_.cover' [/.repository] + (and (case before_upload + (#try.Success _) false + (#try.Failure _) true) + (|> actual + (try\map (binary\= expected)) + (try.default false)))))) + )))) -- cgit v1.2.3