From c85697eee8ce3dac5480a3ba2b31cc4943e1d8e6 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 7 Apr 2022 14:57:35 -0400 Subject: Better snapshot deployments for Aedifex. --- stdlib/source/test/aedifex/command/auto.lux | 10 ++--- stdlib/source/test/aedifex/command/build.lux | 30 ++++++------- stdlib/source/test/aedifex/command/clean.lux | 2 +- stdlib/source/test/aedifex/command/deploy.lux | 33 +++++++------- stdlib/source/test/aedifex/command/test.lux | 6 +-- stdlib/source/test/aedifex/command/version.lux | 57 ++++++++++++------------ stdlib/source/test/aedifex/input.lux | 2 +- stdlib/source/test/aedifex/profile.lux | 21 ++++++--- stdlib/source/test/aedifex/repository/remote.lux | 4 +- 9 files changed, 87 insertions(+), 78 deletions(-) (limited to 'stdlib/source/test/aedifex') diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index 001bfcab3..e8d5ca1ac 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -57,10 +57,8 @@ (if (n.= expected_runs actual_runs) (in {try.#Failure end_signal}) (do (try.with !) - [_ (# fs write (# utf8.codec encoded (%.nat actual_runs)) dummy_file) - _ (# fs modify - (|> actual_runs .int instant.of_millis) - dummy_file)] + [_ (# fs write dummy_file (# utf8.codec encoded (%.nat actual_runs))) + _ (# fs modify dummy_file (|> actual_runs .int instant.of_millis))] (in [shell.normal []])))))])) (def: .public test @@ -98,12 +96,12 @@ (in (do async.monad [verdict (do ///action.monad [_ (# fs make_directory source) - _ (# fs write (binary.empty 0) dummy_path) + _ (# fs write dummy_path (binary.empty 0)) .let [[@runs command] (..command expected_runs end_signal fs dummy_path)] _ (# watcher poll [])] (do [! async.monad] [no_dangling_process! (|> profile - (has ///.#compiler compiler) + (has ///.#lux compiler) ((/.do! 1 watcher command) ($version.echo "") (program.async (program.mock environment.empty home working_directory)) diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 987d35506..a7cd30b1c 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -89,7 +89,7 @@ {.#End} (exception.except shell.no_more_output [])))) - (def: (on_error state) + (def: (on_fail state) (if error? (case state {.#Item head tail} @@ -110,7 +110,7 @@ (do random.monad [lux_version (random.ascii/alpha 5) .let [js_compiler [///dependency.#artifact [///artifact.#group /.lux_group - ///artifact.#name /.js_compiler_name + ///artifact.#name /.js_lux_name ///artifact.#version lux_version] ///dependency.#type ///artifact/type.js_library]]] (`` ($_ random.either @@ -121,10 +121,10 @@ ///artifact.#version lux_version] ///dependency.#type ///artifact/type.lux_library])] - [/.jvm_compiler_name] - [/.python_compiler_name] - [/.lua_compiler_name] - [/.ruby_compiler_name] + [/.jvm_lux_name] + [/.python_lux_name] + [/.lua_lux_name] + [/.ruby_lux_name] )))))) (def: .public resolution @@ -171,13 +171,13 @@ (exception.match? /.no_specified_program error))))) (in (do async.monad [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty profile)] - (_.cover' [/.Compiler /.no_available_compiler] + (_.cover' [/.Lux /.no_available_lux] (case outcome {try.#Success _} false {try.#Failure error} - (exception.match? /.no_available_compiler error))))) + (exception.match? /.no_available_lux error))))) (do ! [.let [console (@version.echo "")] [compiler resolution] ..resolution] @@ -185,18 +185,18 @@ [verdict (do ///action.monad [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs shell resolution - (has ///.#compiler compiler profile)) + (has ///.#lux compiler profile)) start (# console read_line []) end (# console read_line [])] (in (and (text#= /.start start) (text#= /.success end))))] (_.cover' [/.do! /.lux_group - /.jvm_compiler_name - /.js_compiler_name - /.python_compiler_name - /.lua_compiler_name - /.ruby_compiler_name + /.jvm_lux_name + /.js_lux_name + /.python_lux_name + /.lua_lux_name + /.ruby_lux_name /.start /.success] (try.else false verdict))))) @@ -207,7 +207,7 @@ [verdict (do ///action.monad [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async (..bad_shell [])) resolution - (has ///.#compiler compiler profile)) + (has ///.#lux compiler profile)) start (# console read_line []) end (# console read_line [])] (in (and (text#= /.start start) diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index 411504a35..cdc5efafd 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -51,7 +51,7 @@ (def: (create_file! fs [path content]) (-> (file.System Async) [Path Binary] (Async (Try Any))) - (# fs write content path)) + (# fs write path content)) (def: (create_directory! fs path files) (-> (file.System Async) Path (List [Path Binary]) (Async (Try Any))) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index 7cdba510d..0aec02f72 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -25,12 +25,13 @@ ["[0]" set]]] [math ["[0]" random]] + [tool + [compiler + [meta + ["[0]" export]]]] [world ["[0]" file] ["[0]" program {"+" Program}]]]] - [program - [compositor - ["[0]" export]]] [// ["$[0]" install] ["$[0]" version] @@ -45,18 +46,19 @@ ["[1][0]" pom] ["[1][0]" hash] ["[1][0]" repository {"+" Repository} + ["[1]/[0]" local] ["[1]/[0]" remote]] ["[1][0]" artifact {"+" Artifact} ["[1]/[0]" extension]]]]]) -(def: (execute! program repository fs artifact profile) - (-> (Program Async) (Repository Async) (file.System Async) +(def: (execute! program local remote fs artifact profile) + (-> (Program Async) (Repository Async) (Repository Async) (file.System Async) Artifact ///.Profile (Async (Try Text))) (do ///action.monad [.let [console ($version.echo "")] _ ($install.make_sources! fs (the ///.#sources profile)) - _ (/.do! console repository fs artifact profile)] + _ (/.do! console local remote fs artifact profile)] (# console read_line []))) (def: .public test @@ -73,27 +75,28 @@ home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - .let [repository (///repository.mock $repository.mock - $repository.empty) - fs (file.mock (# file.default separator)) - program (program.async (program.mock environment.empty home working_directory))]] + .let [fs (file.mock (# file.default separator)) + program (program.async (program.mock environment.empty home working_directory)) + local (///repository/local.repository program fs) + remote (///repository.mock $repository.mock + $repository.empty)]] (in (do [! async.monad] [verdict (do [! ///action.monad] - [logging (..execute! program repository fs artifact profile) + [logging (..execute! program local remote fs artifact profile) expected_library (|> profile (the ///.#sources) set.list (export.library fs) (# ! each (format.result tar.writer))) - actual_pom (# repository download (///repository/remote.uri (the ///artifact.#version artifact) artifact ///artifact/extension.pom)) - actual_library (# repository download (///repository/remote.uri (the ///artifact.#version artifact) artifact ///artifact/extension.lux_library)) - actual_sha-1 (# repository download (///repository/remote.uri (the ///artifact.#version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.sha-1))) + actual_pom (# remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact ///artifact/extension.pom)) + actual_library (# remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact ///artifact/extension.lux_library)) + actual_sha-1 (# remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.sha-1))) actual_sha-1 (# async.monad in (do try.monad [actual_sha-1 (# utf8.codec decoded actual_sha-1)] (# ///hash.sha-1_codec decoded actual_sha-1))) - actual_md5 (# repository download (///repository/remote.uri (the ///artifact.#version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.md5))) + actual_md5 (# remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.md5))) actual_md5 (# async.monad in (do try.monad [actual_md5 (# utf8.codec decoded actual_md5)] diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index 4f6cfcdc4..4109c99ee 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -65,7 +65,7 @@ [verdict (do ///action.monad [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async (@build.good_shell [])) resolution - (has ///.#compiler compiler profile)) + (has ///.#lux compiler profile)) build_start (# console read_line []) build_end (# console read_line []) test_start (# console read_line []) @@ -88,7 +88,7 @@ (implementation (def: (on_read state) (exception.except shell.no_more_output [])) - (def: (on_error state) + (def: (on_fail state) (exception.except shell.no_more_output [])) (def: (on_write input state) {try.#Failure "on_write"}) @@ -101,7 +101,7 @@ [])] _ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async bad_shell) resolution - (has ///.#compiler compiler profile)) + (has ///.#lux compiler profile)) build_start (# console read_line []) build_end (# console read_line []) test_start (# console read_line []) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index eafff9cce..fff234d52 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -1,32 +1,31 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" maybe] - ["[0]" try] - ["[0]" exception {"+" exception:}] - [concurrency - ["[0]" async {"+" Async}]]] - [data - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]]] - [math - ["[0]" random]] - [tool - [compiler - ["[0]" version] - ["[0]" language "_" - ["[1]/[0]" lux "_" - ["[1]" version]]]]] - [world - ["[0]" console {"+" Console Mock}]]]] - [/// - ["@[0]" profile]] - [\\program - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" maybe] + ["[0]" try] + ["[0]" exception {"+" exception:}] + [concurrency + ["[0]" async {"+" Async}]]] + [data + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]]] + [math + ["[0]" random]] + [meta + ["lux_[0]" version]] + [tool + [compiler + ["[0]" version]]] + [world + ["[0]" console {"+" Console Mock}]]]] + [/// + ["@[0]" profile]] + [\\program + ["[0]" /]]) (exception: .public console_is_closed!) @@ -73,7 +72,7 @@ verdict (do (try.with async.monad) [_ (/.do! console profile) logging (# console read_line [])] - (in (text#= (version.format language/lux.version) + (in (text#= (version.format lux_version.latest) logging)))] (_.cover' [/.do!] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index 4a7100296..bb4d7aa87 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -55,7 +55,7 @@ //format.project %.code (# utf8.codec encoded))] - _ (# fs write profile //project.file) + _ (# fs write //project.file profile) actual (is (Async (Try Profile)) (/.read async.monad fs (list //.default)))] (in (# //.equivalence = diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux index c7f63d254..aa2159929 100644 --- a/stdlib/source/test/aedifex/profile.lux +++ b/stdlib/source/test/aedifex/profile.lux @@ -20,7 +20,13 @@ [math ["[0]" random {"+" Random} ("[1]#[0]" monad)] [number - ["n" nat]]]]] + ["n" nat]]] + [tool + [compiler + [meta + [cli + ["[0]" compiler + ["$[1]" \\test]]]]]]]] [// ["@[0]" artifact] ["@[0]" dependency]] @@ -125,11 +131,14 @@ (..set_of text.hash ..repository) (..set_of //dependency.hash @dependency.random) @dependency.random + (..list_of $compiler.random) (..set_of text.hash ..source) ..target (random.maybe (random.ascii/alpha 1)) - (random.maybe (random.ascii/alpha 1)) - (..dictionary_of text.hash (random.ascii/alpha 1) ..repository) + (random.maybe (random.ascii/alpha 2)) + (..dictionary_of text.hash (random.ascii/alpha 3) ..repository) + (..list_of (random.and (random.ascii/alpha 4) + (random.ascii/alpha 5))) (random#in //runtime.default_java) (random#in //runtime.default_js) (random#in //runtime.default_python) @@ -151,10 +160,10 @@ (_.cover [/.default] (text#= "" /.default)) - (_.cover [/.default_compiler] + (_.cover [/.default_lux] (|> (# /.monoid identity) - (the /.#compiler) - (same? /.default_compiler))) + (the /.#lux) + (same? /.default_lux))) (_.cover [/.default_target] (|> (# /.monoid identity) (the /.#target) diff --git a/stdlib/source/test/aedifex/repository/remote.lux b/stdlib/source/test/aedifex/repository/remote.lux index 9cfc118b9..bd2e68612 100644 --- a/stdlib/source/test/aedifex/repository/remote.lux +++ b/stdlib/source/test/aedifex/repository/remote.lux @@ -51,12 +51,12 @@ (maybe#each (same? /.user_agent)) (maybe.else false)) (case [method input] - [@http.#Get {.#None}] + [{@http.#Get} {.#None}] [http/status.ok [@http.#headers (http.headers (list)) @http.#body (..url_body url)]] - [@http.#Put {.#Some input}] + [{@http.#Put} {.#Some input}] (if (|> headers (dictionary.value "Authorization") (maybe#each (text#= (//identity.basic_auth user password))) -- cgit v1.2.3