From 772f621c19408c711c1e587668a52a8cfeeea418 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 12 Aug 2022 22:26:57 -0400 Subject: Fixes for Aedifex tests. --- stdlib/source/test/aedifex/command/deploy.lux | 99 ++++++++++++++++++--------- 1 file changed, 66 insertions(+), 33 deletions(-) (limited to 'stdlib/source/test/aedifex/command/deploy.lux') diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index 55fac78c6..6e8d38d31 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -2,22 +2,21 @@ [library [lux (.except) [abstract - [monad (.only do)]] + ["[0]" monad (.only do)]] [control ["[0]" maybe] ["[0]" try (.only Try)] + ["[0]" exception] [concurrency - ["[0]" async (.only Async)]] - [parser - ["[0]" environment]]] + ["[0]" async (.only Async) (.use "[1]#[0]" monad)]]] [data - ["[0]" binary (.use "[1]#[0]" equivalence)] + ["[0]" binary (.use "[1]#[0]" equivalence) + ["[0]" \\format]] ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)] [encoding ["[0]" utf8]]] ["[0]" format - ["[1]" binary] ["[0]" tar] ["[0]" xml]] [collection @@ -30,41 +29,74 @@ ["[0]" export]]]] [world ["[0]" file] - ["[0]" program (.only Program)] - ["[0]" shell]] + ["[0]" shell (.only Process Shell)] + ["[0]" environment + ["program" / (.only Environment)] + ["[1]" \\parser]]] [test ["[0]" unit] ["_" property (.only Test)]]]] - [// - ["$[0]" build] - ["$[0]" install] - ["$[0]" version] + ["$" // + ["[1][0]" install] + ["[1][0]" version] [// - ["$[0]" profile] - ["$[0]" repository]]] + ["[1][0]" profile] + ["[1][0]" repository]]] [\\program ["[0]" / (.only) - ["//[1]" /// - ["[1]" profile] - ["[1][0]" action] - ["[1][0]" pom] - ["[1][0]" hash] - ["[1][0]" repository (.only Repository) - ["[1]/[0]" local] - ["[1]/[0]" remote]] - ["[1][0]" artifact (.only Artifact) - ["[1]/[0]" extension]]]]]) + ["/[1]" // + ["[1][0]" install] + ["/[1]" // + ["[1]" profile] + ["[1][0]" action] + ["[1][0]" pom] + ["[1][0]" hash] + ["[1][0]" repository (.only Repository) + ["[1]/[0]" local] + ["[1]/[0]" remote]] + ["[1][0]" artifact (.only Artifact) + ["[1]/[0]" extension]]]]]]) + +(def (shell fs) + (-> (file.System Async) (Shell Async)) + (implementation + (def (execute [environment working_directory command arguments]) + (do [! ///action.monad] + [files (at fs directory_files working_directory) + _ (monad.each ! + (function (_ file) + (do ! + [_ (is (Async (Try Any)) + (file.copy async.monad fs + file + (format file ".asc")))] + (in []))) + files)] + (<| in + (is (Process Async)) + (implementation + (def (read _) + (async#in (exception.except shell.no_more_output []))) + (def (fail _) + (async#in (exception.except shell.no_more_output []))) + (def (write input) + (async#in {try.#Failure "write"})) + (def (destroy _) + (async#in {try.#Failure "destroy"})) + (def (await _) + (in shell.error)))))))) (def (execute! program local remote fs artifact profile) - (-> (Program Async) (Repository Async) (Repository Async) (file.System Async) + (-> (Environment Async) (Repository Async) (Repository Async) (file.System Async) Artifact ///.Profile - (Async (Try Text))) + (Async (Try [Text Text]))) (do ///action.monad - [.let [console ($version.echo "") - shell (shell.async ($build.bad_shell []))] + [.let [console ($version.echo "")] _ ($install.make_sources! fs (the ///.#sources profile)) - _ (/.do! program shell console local remote fs artifact profile)] - (at console read_line []))) + _ (/.do! program (..shell fs) console local remote fs artifact profile) + locally_installed! (at console read_line []) + deployed! (at console read_line [])] + (in [locally_installed! deployed!]))) (def .public test Test @@ -87,12 +119,12 @@ $repository.empty)]] (in (do [! async.monad] [verdict (do [! ///action.monad] - [logging (..execute! program local remote fs artifact profile) + [[locally_installed! deployed!] (..execute! program local remote fs artifact profile) expected_library (|> profile (the ///.#sources) set.list (export.library fs) - (at ! each (format.result tar.format))) + (at ! each (\\format.result tar.format))) actual_pom (at remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact ///artifact/extension.pom)) actual_library (at remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact ///artifact/extension.lux_library)) @@ -108,7 +140,8 @@ (at ///hash.md5_codec decoded actual_md5))) .let [succeeded! - (text#= /.success logging) + (and (text#= //install.success locally_installed!) + (text#= /.success deployed!)) deployed_library! (binary#= expected_library -- cgit v1.2.3