diff options
author | Eduardo Julian | 2020-12-25 09:22:38 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-12-25 09:22:38 -0400 |
commit | 4ca397765805eda5ddee393901ed3a02001a960a (patch) | |
tree | 2ab184a1a4e244f3a69e86c8a7bb3ad49c22b4a3 /stdlib/source/test/aedifex/command | |
parent | d29e091e98dabb8dfcf816899ada480ecbf7e357 (diff) |
Replaced kebab-case with snake_case for naming convention.
Diffstat (limited to 'stdlib/source/test/aedifex/command')
-rw-r--r-- | stdlib/source/test/aedifex/command/auto.lux | 56 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/build.lux | 118 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/clean.lux | 86 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/deploy.lux | 68 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/deps.lux | 54 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/install.lux | 38 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/pom.lux | 12 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/test.lux | 74 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/command/version.lux | 26 |
9 files changed, 266 insertions, 266 deletions
diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index c43d8642f..817b4db5f 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -47,26 +47,26 @@ ["#." dependency ["#/." resolution (#+ Resolution)]]]]]}) -(def: (command end-signal dummy-files) +(def: (command end_signal dummy_files) (-> Text (List Path) [(Atom [Nat (List Path)]) (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command Any))]) (let [@runs (: (Atom [Nat (List Path)]) - (atom.atom [0 dummy-files]))] + (atom.atom [0 dummy_files]))] [@runs (function (_ console program fs shell resolution profile) (do {! promise.monad} - [[runs remaining-files] (promise.future - (atom.update (function (_ [runs remaining-files]) - [(inc runs) remaining-files]) + [[runs remaining_files] (promise.future + (atom.update (function (_ [runs remaining_files]) + [(inc runs) remaining_files]) @runs))] - (case remaining-files + (case remaining_files #.Nil - (wrap (#try.Failure end-signal)) + (wrap (#try.Failure end_signal)) (#.Cons head tail) (do (try.with !) - [_ (!.use (\ fs create-file) [head])] + [_ (!.use (\ fs create_file) [head])] (do ! [_ (promise.future (atom.write [runs tail] @runs))] (wrap (#try.Success [])))))))])) @@ -77,47 +77,47 @@ (do {! random.monad} [#let [/ (\ file.default separator) [fs watcher] (watch.mock /)] - end-signal (random.ascii/alpha 5) + end_signal (random.ascii/alpha 5) program (random.ascii/alpha 5) target (random.ascii/alpha 5) home (random.ascii/alpha 5) - working-directory (random.ascii/alpha 5) - expected-runs (\ ! map (|>> (n.% 10) (n.max 2)) random.nat) + working_directory (random.ascii/alpha 5) + expected_runs (\ ! map (|>> (n.% 10) (n.max 2)) random.nat) source (random.ascii/alpha 5) - dummy-files (|> (random.ascii/alpha 5) - (random.set text.hash (dec expected-runs)) - (\ ! map (|>> set.to-list (list\map (|>> (format source /)))))) - #let [empty-profile (: Profile + dummy_files (|> (random.ascii/alpha 5) + (random.set text.hash (dec expected_runs)) + (\ ! map (|>> set.to_list (list\map (|>> (format source /)))))) + #let [empty_profile (: Profile (\ ///.monoid identity)) - with-target (: (-> Profile Profile) + with_target (: (-> Profile Profile) (set@ #///.target (#.Some target))) - with-program (: (-> Profile Profile) + with_program (: (-> Profile Profile) (set@ #///.program (#.Some program))) - profile (|> empty-profile - with-program - with-target - (set@ #///.sources (set.from-list text.hash (list source))))] + profile (|> empty_profile + with_program + with_target + (set@ #///.sources (set.from_list text.hash (list source))))] resolution @build.resolution] ($_ _.and (wrap (do promise.monad [verdict (do ///action.monad - [#let [[@runs command] (..command end-signal dummy-files)] - _ (!.use (\ fs create-directory) [source]) + [#let [[@runs command] (..command end_signal dummy_files)] + _ (!.use (\ fs create_directory) [source]) _ (\ watcher poll [])] (do promise.monad [outcome ((/.do! watcher command) (@version.echo "") - (program.async (program.mock environment.empty home working-directory)) + (program.async (program.mock environment.empty home working_directory)) fs - (@build.good-shell []) + (@build.good_shell []) resolution profile) - [actual-runs _] (promise.future (atom.read @runs))] - (wrap (#try.Success (and (n.= expected-runs actual-runs) + [actual_runs _] (promise.future (atom.read @runs))] + (wrap (#try.Success (and (n.= expected_runs actual_runs) (case outcome (#try.Failure error) - (is? end-signal error) + (is? end_signal error) (#try.Success _) false))))))] diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 025d01c0b..8a4df9a7e 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -36,55 +36,55 @@ ["#." dependency ["#/." resolution]]]]}) -(def: #export good-shell +(def: #export good_shell (-> Any (Shell Promise)) (shell.mock - (function (_ [actual-environment actual-working-directory actual-command actual-arguments]) + (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) (#try.Success (: (shell.Simulation []) (structure - (def: (on-read state) - (#try.Failure "on-read")) - (def: (on-error state) - (#try.Failure "on-error")) - (def: (on-write input state) - (#try.Failure "on-write")) - (def: (on-destroy state) - (#try.Failure "on-destroy")) - (def: (on-await state) + (def: (on_read state) + (#try.Failure "on_read")) + (def: (on_error state) + (#try.Failure "on_error")) + (def: (on_write input state) + (#try.Failure "on_write")) + (def: (on_destroy state) + (#try.Failure "on_destroy")) + (def: (on_await state) (#try.Success [state shell.normal])))))))) -(def: #export bad-shell +(def: #export bad_shell (-> Any (Shell Promise)) (shell.mock - (function (_ [actual-environment actual-working-directory actual-command actual-arguments]) + (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) (#try.Success (: (shell.Simulation []) (structure - (def: (on-read state) - (#try.Failure "on-read")) - (def: (on-error state) - (#try.Failure "on-error")) - (def: (on-write input state) - (#try.Failure "on-write")) - (def: (on-destroy state) - (#try.Failure "on-destroy")) - (def: (on-await state) + (def: (on_read state) + (#try.Failure "on_read")) + (def: (on_error state) + (#try.Failure "on_error")) + (def: (on_write input state) + (#try.Failure "on_write")) + (def: (on_destroy state) + (#try.Failure "on_destroy")) + (def: (on_await state) (#try.Success [state shell.error])))))))) (def: compiler (do random.monad - [lux-version (random.ascii/alpha 5) - #let [jvm-compiler {#///dependency.artifact {#///artifact.group /.lux-group - #///artifact.name /.jvm-compiler-name - #///artifact.version lux-version} - #///dependency.type ///artifact/type.lux-library} - js-compiler {#///dependency.artifact {#///artifact.group /.lux-group - #///artifact.name /.js-compiler-name - #///artifact.version lux-version} - #///dependency.type ///artifact/type.lux-library}]] - (random.either (wrap jvm-compiler) - (wrap js-compiler)))) + [lux_version (random.ascii/alpha 5) + #let [jvm_compiler {#///dependency.artifact {#///artifact.group /.lux_group + #///artifact.name /.jvm_compiler_name + #///artifact.version lux_version} + #///dependency.type ///artifact/type.lux_library} + js_compiler {#///dependency.artifact {#///artifact.group /.lux_group + #///artifact.name /.js_compiler_name + #///artifact.version lux_version} + #///dependency.type ///artifact/type.lux_library}]] + (random.either (wrap jvm_compiler) + (wrap js_compiler)))) (def: #export resolution (do random.monad @@ -98,63 +98,63 @@ (<| (_.covering /._) (do {! random.monad} [#let [fs (file.mock (\ file.default separator)) - shell (..good-shell [])] + shell (..good_shell [])] program (random.ascii/alpha 5) target (random.ascii/alpha 5) home (random.ascii/alpha 5) - working-directory (random.ascii/alpha 5) - #let [empty-profile (: Profile + working_directory (random.ascii/alpha 5) + #let [empty_profile (: Profile (\ ///.monoid identity)) - with-target (: (-> Profile Profile) + with_target (: (-> Profile Profile) (set@ #///.target (#.Some target))) - with-program (: (-> Profile Profile) + with_program (: (-> Profile Profile) (set@ #///.program (#.Some program))) - profile (|> empty-profile - with-program - with-target)]] + profile (|> empty_profile + with_program + with_target)]] ($_ _.and (wrap (do promise.monad - [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working-directory)) fs shell ///dependency/resolution.empty - (with-target empty-profile))] - (_.cover' [/.no-specified-program] + [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty + (with_target empty_profile))] + (_.cover' [/.no_specified_program] (case outcome (#try.Success _) false (#try.Failure error) - (exception.match? /.no-specified-program error))))) + (exception.match? /.no_specified_program error))))) (wrap (do promise.monad - [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working-directory)) fs shell ///dependency/resolution.empty - (with-program empty-profile))] - (_.cover' [/.no-specified-target] + [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty + (with_program empty_profile))] + (_.cover' [/.no_specified_target] (case outcome (#try.Success _) false (#try.Failure error) - (exception.match? /.no-specified-target error))))) + (exception.match? /.no_specified_target error))))) (wrap (do promise.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] + [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty profile)] + (_.cover' [/.Compiler /.no_available_compiler] (case outcome (#try.Success _) false (#try.Failure error) - (exception.match? /.no-available-compiler error))))) + (exception.match? /.no_available_compiler error))))) (do ! [#let [console (@version.echo "")] resolution ..resolution] (wrap (do promise.monad [verdict (do ///action.monad - [_ (/.do! console (program.async (program.mock environment.empty home working-directory)) fs shell resolution profile) - start (!.use (\ console read-line) []) - end (!.use (\ console read-line) [])] + [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs shell resolution profile) + start (!.use (\ console read_line) []) + end (!.use (\ console read_line) [])] (wrap (and (text\= /.start start) (text\= /.success end))))] (_.cover' [/.do! - /.lux-group /.jvm-compiler-name /.js-compiler-name + /.lux_group /.jvm_compiler_name /.js_compiler_name /.start /.success] (try.default false verdict))))) (do ! @@ -162,9 +162,9 @@ resolution ..resolution] (wrap (do promise.monad [verdict (do ///action.monad - [_ (/.do! console (program.async (program.mock environment.empty home working-directory)) fs (..bad-shell []) resolution profile) - start (!.use (\ console read-line) []) - end (!.use (\ console read-line) [])] + [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (..bad_shell []) resolution profile) + start (!.use (\ console read_line) []) + end (!.use (\ console read_line) [])] (wrap (and (text\= /.start start) (text\= /.failure end))))] (_.cover' [/.failure] diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index 739bd1a34..c429f34fb 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -37,7 +37,7 @@ ["#" profile] ["#." action (#+ Action)]]]}) -(def: node-name +(def: node_name (Random Text) (random.ascii/alpha 10)) @@ -45,58 +45,58 @@ (-> Path (Random (List [Path Binary]))) (do {! random.monad} [count (\ ! map (n.% 10) random.nat) - names (random.set text.hash count ..node-name) + names (random.set text.hash count ..node_name) contents (random.list count (_binary.random 100))] - (wrap (list.zip/2 (list\map (|>> (format prefix)) (set.to-list names)) + (wrap (list.zip/2 (list\map (|>> (format prefix)) (set.to_list names)) contents)))) -(def: (create-file! fs [path content]) +(def: (create_file! fs [path content]) (-> (file.System Promise) [Path Binary] (Promise (Try Any))) (do {! (try.with promise.monad)} [file (: (Promise (Try (File Promise))) - (file.get-file promise.monad fs path))] - (!.use (\ file over-write) content))) + (file.get_file promise.monad fs path))] + (!.use (\ file over_write) content))) -(def: (create-directory! fs path files) +(def: (create_directory! fs path files) (-> (file.System Promise) Path (List [Path Binary]) (Promise (Try Any))) (do {! (try.with promise.monad)} [_ (: (Promise (Try Path)) - (file.make-directories promise.monad fs path)) - _ (monad.map ! (..create-file! fs) files)] + (file.make_directories promise.monad fs path)) + _ (monad.map ! (..create_file! fs) files)] (wrap []))) -(def: (directory-exists? fs) +(def: (directory_exists? fs) (-> (file.System Promise) Path (Promise (Try Bit))) - (|>> (file.directory-exists? promise.monad fs) (try.lift promise.monad))) + (|>> (file.directory_exists? promise.monad fs) (try.lift promise.monad))) -(def: (file-exists? fs) +(def: (file_exists? fs) (-> (file.System Promise) Path (Promise (Try Bit))) - (|>> (file.file-exists? promise.monad fs) (try.lift promise.monad))) + (|>> (file.file_exists? promise.monad fs) (try.lift promise.monad))) -(def: (assets-exist? fs directory-path files) +(def: (assets_exist? fs directory_path files) (-> (file.System Promise) Path (List [Path Binary]) (Promise (Try Bit))) (do {! (try.with promise.monad)} - [directory-exists? (..directory-exists? fs directory-path) - files-exist? (: (Action (List Bit)) + [directory_exists? (..directory_exists? fs directory_path) + files_exist? (: (Action (List Bit)) (|> files (list\map product.left) - (monad.map ///action.monad (..file-exists? fs))))] - (wrap (and directory-exists? - (list.every? (|>>) files-exist?))))) + (monad.map ///action.monad (..file_exists? fs))))] + (wrap (and directory_exists? + (list.every? (|>>) files_exist?))))) (def: #export test Test (<| (_.covering /._) (do {! random.monad} - [context ..node-name - target ..node-name - sub ..node-name + [context ..node_name + target ..node_name + sub ..node_name #let [fs (file.mock (\ file.default separator)) / (\ fs separator) - target-path (format context / target) - sub-path (format target-path / sub)] - direct-files (..files (format target-path /)) - sub-files (..files (format sub-path /)) + target_path (format context / target) + sub_path (format target_path / sub)] + direct_files (..files (format target_path /)) + sub_files (..files (format sub_path /)) dummy @profile.random] ($_ _.and @@ -105,28 +105,28 @@ verdict (do {! (try.with promise.monad)} [_ (/.do! console fs (set@ #///.target #.None dummy))] (\ ! map (text\= /.failure) - (!.use (\ console read-line) [])))] + (!.use (\ console read_line) [])))] (_.cover' [/.failure] (try.default false verdict)))) (wrap (do promise.monad [#let [console (@version.echo "")] verdict (do {! (try.with promise.monad)} - [_ (..create-directory! fs target-path direct-files) - _ (..create-directory! fs sub-path sub-files) - context-exists!/pre (..directory-exists? fs context) - target-exists!/pre (..assets-exist? fs target-path direct-files) - sub-exists!/pre (..assets-exist? fs sub-path sub-files) - _ (/.do! console fs (set@ #///.target (#.Some target-path) dummy)) - context-exists!/post (..directory-exists? fs context) - target-exists!/post (..assets-exist? fs target-path direct-files) - sub-exists!/post (..assets-exist? fs sub-path sub-files) - logging (!.use (\ console read-line) [])] - (wrap (and (and context-exists!/pre - context-exists!/post) - (and target-exists!/pre - (not target-exists!/post)) - (and sub-exists!/pre - (not sub-exists!/post)) + [_ (..create_directory! fs target_path direct_files) + _ (..create_directory! fs sub_path sub_files) + context_exists!/pre (..directory_exists? fs context) + target_exists!/pre (..assets_exist? fs target_path direct_files) + sub_exists!/pre (..assets_exist? fs sub_path sub_files) + _ (/.do! console fs (set@ #///.target (#.Some target_path) dummy)) + context_exists!/post (..directory_exists? fs context) + target_exists!/post (..assets_exist? fs target_path direct_files) + sub_exists!/post (..assets_exist? fs sub_path sub_files) + logging (!.use (\ console read_line) [])] + (wrap (and (and context_exists!/pre + context_exists!/post) + (and target_exists!/pre + (not target_exists!/post)) + (and sub_exists!/pre + (not sub_exists!/post)) (text\= /.success logging))))] (_.cover' [/.do! /.success] (try.default false verdict)))) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index 86f3e0dbb..b6cd89469 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -53,9 +53,9 @@ ["#." artifact (#+ Artifact) ["#/." extension]]]]]}) -(def: (make-sources! fs sources) +(def: (make_sources! fs sources) (-> (file.System Promise) (Set Path) (Promise (Try Any))) - (loop [sources (set.to-list sources)] + (loop [sources (set.to_list sources)] (case sources #.Nil (|> [] @@ -65,9 +65,9 @@ (#.Cons head tail) (do (try.with promise.monad) [_ (: (Promise (Try Path)) - (file.make-directories promise.monad fs head)) + (file.make_directories promise.monad fs head)) _ (: (Promise (Try (File Promise))) - (file.get-file promise.monad fs (format head (\ fs separator) head ".lux")))] + (file.get_file promise.monad fs (format head (\ fs separator) head ".lux")))] (recur tail))))) (def: (execute! program repository fs artifact profile) @@ -78,67 +78,67 @@ [home (\ program home [])] (do ///action.monad [#let [console (@version.echo "")] - _ (..make-sources! fs (get@ #///.sources profile)) + _ (..make_sources! fs (get@ #///.sources profile)) _ (: (Promise (Try Path)) - (file.make-directories promise.monad fs (///local.repository fs home))) + (file.make_directories promise.monad fs (///local.repository fs home))) _ (/.do! console repository fs artifact profile)] - (!.use (\ console read-line) [])))) + (!.use (\ console read_line) [])))) (def: #export test Test (<| (_.covering /._) (do {! random.monad} - [[artifact expected-pom profile] + [[artifact expected_pom profile] (random.one (function (_ profile) (do maybe.monad [artifact (get@ #///.identity profile) - expected-pom (try.to-maybe (///pom.write profile))] - (wrap [artifact expected-pom profile]))) + expected_pom (try.to_maybe (///pom.write profile))] + (wrap [artifact expected_pom profile]))) @profile.random) home (random.ascii/alpha 5) - working-directory (random.ascii/alpha 5) + working_directory (random.ascii/alpha 5) #let [repository (///repository.mock @repository.simulation @repository.empty) fs (file.mock (\ file.default separator)) - program (program.async (program.mock environment.empty home working-directory))]] + program (program.async (program.mock environment.empty home working_directory))]] (wrap (do {! promise.monad} [verdict (do {! ///action.monad} [logging (..execute! program repository fs artifact profile) - expected-library (|> profile + expected_library (|> profile (get@ #///.sources) - set.to-list + set.to_list (export.library fs) (\ ! map (format.run tar.writer))) - actual-pom (\ repository download (///repository.uri artifact ///artifact/extension.pom)) - actual-library (\ repository download (///repository.uri artifact ///artifact/extension.lux-library)) - actual-sha-1 (\ repository download (///repository.uri artifact (format ///artifact/extension.lux-library ///artifact/extension.sha-1))) - actual-md5 (\ repository download (///repository.uri artifact (format ///artifact/extension.lux-library ///artifact/extension.md5))) + actual_pom (\ repository download (///repository.uri artifact ///artifact/extension.pom)) + actual_library (\ repository download (///repository.uri artifact ///artifact/extension.lux_library)) + actual_sha-1 (\ repository download (///repository.uri artifact (format ///artifact/extension.lux_library ///artifact/extension.sha-1))) + actual_md5 (\ repository download (///repository.uri artifact (format ///artifact/extension.lux_library ///artifact/extension.md5))) - #let [deployed-library! + #let [deployed_library! (\ binary.equivalence = - expected-library - actual-library) + expected_library + actual_library) - deployed-pom! + deployed_pom! (\ binary.equivalence = - (|> expected-pom (\ xml.codec encode) (\ encoding.utf8 encode)) - actual-pom) + (|> expected_pom (\ xml.codec encode) (\ encoding.utf8 encode)) + actual_pom) - deployed-sha-1! + deployed_sha-1! (\ binary.equivalence = - (///hash.data (///hash.sha-1 expected-library)) - actual-sha-1) + (///hash.data (///hash.sha-1 expected_library)) + actual_sha-1) - deployed-md5! + deployed_md5! (\ binary.equivalence = - (///hash.data (///hash.md5 expected-library)) - actual-md5)]] + (///hash.data (///hash.md5 expected_library)) + actual_md5)]] (wrap (and (text\= //clean.success logging) - deployed-library! - deployed-pom! - deployed-sha-1! - deployed-md5!)))] + deployed_library! + deployed_pom! + deployed_sha-1! + deployed_md5!)))] (_.cover' [/.do!] (try.default false verdict))))))) diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 84c51dc93..7002238e7 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -52,55 +52,55 @@ (<| (_.covering /._) (do random.monad [home (random.ascii/alpha 5) - working-directory (random.ascii/alpha 5) + working_directory (random.ascii/alpha 5) - dependee-artifact $///artifact.random - depender-artifact (random.filter (predicate.complement - (\ ///artifact.equivalence = dependee-artifact)) + dependee_artifact $///artifact.random + depender_artifact (random.filter (predicate.complement + (\ ///artifact.equivalence = dependee_artifact)) $///artifact.random) - [_ dependee-package] $///package.random - [_ depender-package] $///package.random + [_ dependee_package] $///package.random + [_ depender_package] $///package.random - #let [dependee {#///dependency.artifact dependee-artifact - #///dependency.type ///artifact/type.lux-library} - depender {#///dependency.artifact depender-artifact - #///dependency.type ///artifact/type.lux-library} + #let [dependee {#///dependency.artifact dependee_artifact + #///dependency.type ///artifact/type.lux_library} + depender {#///dependency.artifact depender_artifact + #///dependency.type ///artifact/type.lux_library} - dependee-pom (|> (\ ///.monoid identity) - (set@ #///.identity (#.Some dependee-artifact)) + dependee_pom (|> (\ ///.monoid identity) + (set@ #///.identity (#.Some dependee_artifact)) ///pom.write try.assume) - depender-pom (|> (\ ///.monoid identity) - (set@ #///.identity (#.Some depender-artifact)) - (set@ #///.dependencies (set.from-list ///dependency.hash (list dependee))) + depender_pom (|> (\ ///.monoid identity) + (set@ #///.identity (#.Some depender_artifact)) + (set@ #///.dependencies (set.from_list ///dependency.hash (list dependee))) ///pom.write try.assume) - dependee-package (|> dependee-package + dependee_package (|> dependee_package (set@ #///package.origin #///package.Remote) - (set@ #///package.pom [dependee-pom #///dependency/status.Unverified])) - depender-package (|> depender-package + (set@ #///package.pom [dependee_pom #///dependency/status.Unverified])) + depender_package (|> depender_package (set@ #///package.origin #///package.Remote) - (set@ #///package.pom [depender-pom #///dependency/status.Unverified])) + (set@ #///package.pom [depender_pom #///dependency/status.Unverified])) fs (file.mock (\ file.default separator)) - program (program.async (program.mock environment.empty home working-directory))]] + program (program.async (program.mock environment.empty home working_directory))]] (wrap (do promise.monad [verdict (do ///action.monad [#let [console (@version.echo "")] pre (|> ///dependency/resolution.empty - (dictionary.put dependee dependee-package) - (///cache.write-all program fs)) + (dictionary.put dependee dependee_package) + (///cache.write_all program fs)) post (|> (\ ///.monoid identity) - (set@ #///.dependencies (set.from-list ///dependency.hash (list dependee depender))) - (/.do! program console fs (list (///repository.mock ($///dependency/resolution.single depender-artifact depender-package) [])))) + (set@ #///.dependencies (set.from_list ///dependency.hash (list dependee depender))) + (/.do! program console fs (list (///repository.mock ($///dependency/resolution.single depender_artifact depender_package) [])))) logging! (\ ///action.monad map (text\= //clean.success) - (!.use (\ console read-line) []))] + (!.use (\ console read_line) []))] (wrap (and logging! - (and (set.member? pre dependee-artifact) - (not (set.member? pre depender-artifact))) + (and (set.member? pre dependee_artifact) + (not (set.member? pre depender_artifact))) (and (dictionary.key? post dependee) (dictionary.key? post depender)))))] (_.cover' [/.do!] diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index 9ffa65bab..9df49efa4 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -44,9 +44,9 @@ ["#." artifact ["#/." extension]]]]]}) -(def: (make-sources! fs sources) +(def: (make_sources! fs sources) (-> (file.System Promise) (Set Path) (Promise (Try Any))) - (loop [sources (set.to-list sources)] + (loop [sources (set.to_list sources)] (case sources #.Nil (|> [] @@ -56,9 +56,9 @@ (#.Cons head tail) (do (try.with promise.monad) [_ (: (Promise (Try Path)) - (file.make-directories promise.monad fs head)) + (file.make_directories promise.monad fs head)) _ (: (Promise (Try (File Promise))) - (file.get-file promise.monad fs (format head (\ fs separator) head ".lux")))] + (file.get_file promise.monad fs (format head (\ fs separator) head ".lux")))] (recur tail))))) (def: (execute! program fs sample) @@ -67,11 +67,11 @@ [home (\ program home [])] (do ///action.monad [#let [console (@version.echo "")] - _ (..make-sources! fs (get@ #///.sources sample)) + _ (..make_sources! fs (get@ #///.sources sample)) _ (: (Promise (Try Path)) - (file.make-directories promise.monad fs (///local.repository fs home))) + (file.make_directories promise.monad fs (///local.repository fs home))) _ (/.do! program console fs sample)] - (!.use (\ console read-line) [])))) + (!.use (\ console read_line) [])))) (def: #export test Test @@ -81,33 +81,33 @@ 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)] ($_ _.and (wrap (do {! promise.monad} [#let [fs (file.mock (\ file.default separator)) - program (program.async (program.mock environment.empty home working-directory))] + program (program.async (program.mock environment.empty home working_directory))] verdict (do ///action.monad [logging (..execute! program fs sample) - #let [artifact-path (format (///local.path fs home identity) + #let [artifact_path (format (///local.path fs home identity) (\ fs separator) (///artifact.identity identity)) - library-path (format artifact-path ///artifact/extension.lux-library) - pom-path (format artifact-path ///artifact/extension.pom)] + library_path (format artifact_path ///artifact/extension.lux_library) + pom_path (format artifact_path ///artifact/extension.pom)] - library-exists! (\ promise.monad map + library_exists! (\ promise.monad map exception.return - (file.file-exists? promise.monad fs library-path)) - pom-exists! (\ promise.monad map + (file.file_exists? promise.monad fs library_path)) + pom_exists! (\ promise.monad map exception.return - (file.file-exists? promise.monad fs pom-path))] + (file.file_exists? promise.monad fs pom_path))] (wrap (and (text\= //clean.success logging) - library-exists! - pom-exists!)))] + library_exists! + pom_exists!)))] (_.cover' [/.do!] (try.default false verdict)))) (wrap (do {! promise.monad} [#let [fs (file.mock (\ file.default separator)) - program (program.async (program.mock environment.empty home working-directory))] + program (program.async (program.mock environment.empty home working_directory))] logging (..execute! program fs (set@ #///.identity #.None sample))] (_.cover' [/.failure] (|> logging diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index d179031ea..33c102926 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -49,21 +49,21 @@ (try\map (|>> (\ xml.codec encode) (\ encoding.utf8 encode))) (\ ! wrap)) file (: (Promise (Try (File Promise))) - (file.get-file promise.monad fs path)) + (file.get_file promise.monad fs path)) actual (!.use (\ file content) []) logging! (\ ///action.monad map (text\= //clean.success) - (!.use (\ console read-line) [])) + (!.use (\ console read_line) [])) - #let [expected-path! + #let [expected_path! (text\= ///pom.file path) - expected-content! + expected_content! (\ binary.equivalence = expected actual)]] (wrap (and logging! - expected-path! - expected-content!)))] + expected_path! + expected_content!)))] (_.cover' [/.do!] (try.default false verdict))) diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index b63662bc0..2d077ab87 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -45,32 +45,32 @@ [program (random.ascii/alpha 5) target (random.ascii/alpha 5) home (random.ascii/alpha 5) - working-directory (random.ascii/alpha 5) - #let [empty-profile (: Profile + working_directory (random.ascii/alpha 5) + #let [empty_profile (: Profile (\ ///.monoid identity)) - with-target (: (-> Profile Profile) + with_target (: (-> Profile Profile) (set@ #///.target (#.Some target))) - with-program (: (-> Profile Profile) + with_program (: (-> Profile Profile) (set@ #///.program (#.Some program))) - profile (|> empty-profile - with-program - with-target)] + profile (|> empty_profile + with_program + with_target)] resolution @build.resolution] ($_ _.and (let [fs (file.mock (\ file.default separator)) console (@version.echo "")] (wrap (do promise.monad [verdict (do ///action.monad - [_ (/.do! console (program.async (program.mock environment.empty home working-directory)) fs (@build.good-shell []) resolution profile) - build-start (!.use (\ console read-line) []) - build-end (!.use (\ console read-line) []) - test-start (!.use (\ console read-line) []) - test-end (!.use (\ console read-line) [])] - (wrap (and (and (text\= //build.start build-start) - (text\= //build.success build-end)) - (and (text\= /.start test-start) - (text\= /.success test-end)))))] + [_ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (@build.good_shell []) resolution profile) + build_start (!.use (\ console read_line) []) + build_end (!.use (\ console read_line) []) + test_start (!.use (\ console read_line) []) + test_end (!.use (\ console read_line) [])] + (wrap (and (and (text\= //build.start build_start) + (text\= //build.success build_end)) + (and (text\= /.start test_start) + (text\= /.success test_end)))))] (_.cover' [/.do! /.start /.success] (try.default false verdict))))) @@ -78,33 +78,33 @@ console (@version.echo "")] (wrap (do promise.monad [verdict (do ///action.monad - [#let [bad-shell (shell.mock - (function (_ [actual-environment actual-working-directory actual-command actual-arguments]) + [#let [bad_shell (shell.mock + (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) (#try.Success (: (shell.Simulation []) (structure - (def: (on-read state) - (#try.Failure "on-read")) - (def: (on-error state) - (#try.Failure "on-error")) - (def: (on-write input state) - (#try.Failure "on-write")) - (def: (on-destroy state) - (#try.Failure "on-destroy")) - (def: (on-await state) - (#try.Success [state (if (text.ends-with? " build" actual-command) + (def: (on_read state) + (#try.Failure "on_read")) + (def: (on_error state) + (#try.Failure "on_error")) + (def: (on_write input state) + (#try.Failure "on_write")) + (def: (on_destroy state) + (#try.Failure "on_destroy")) + (def: (on_await state) + (#try.Success [state (if (text.ends_with? " build" actual_command) shell.normal shell.error)])))))) [])] - _ (/.do! console (program.async (program.mock environment.empty home working-directory)) fs bad-shell resolution profile) - build-start (!.use (\ console read-line) []) - build-end (!.use (\ console read-line) []) - test-start (!.use (\ console read-line) []) - test-end (!.use (\ console read-line) [])] - (wrap (and (and (text\= //build.start build-start) - (text\= //build.success build-end)) - (and (text\= /.start test-start) - (text\= /.failure test-end)))))] + _ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs bad_shell resolution profile) + build_start (!.use (\ console read_line) []) + build_end (!.use (\ console read_line) []) + test_start (!.use (\ console read_line) []) + test_end (!.use (\ console read_line) [])] + (wrap (and (and (text\= //build.start build_start) + (text\= //build.success build_end)) + (and (text\= /.start test_start) + (text\= /.failure test_end)))))] (_.cover' [/.failure] (try.default false verdict))))) )))) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index 5e60f6b9b..ee26b3b5d 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -29,34 +29,34 @@ {#program ["." /]}) -(exception: #export console-is-closed!) +(exception: #export console_is_closed!) (structure: simulation (Simulation [Bit Text]) - (def: (on-read [open? state]) + (def: (on_read [open? state]) (if open? - (try.from-maybe + (try.from_maybe (do maybe.monad [head (text.nth 0 state) [_ tail] (text.split 1 state)] (wrap [[open? tail] head]))) - (exception.throw ..console-is-closed! []))) - (def: (on-read-line [open? state]) + (exception.throw ..console_is_closed! []))) + (def: (on_read_line [open? state]) (if open? - (try.from-maybe + (try.from_maybe (do maybe.monad - [[output state] (text.split-with text.new-line state)] + [[output state] (text.split_with text.new_line state)] (wrap [[open? state] output]))) - (exception.throw ..console-is-closed! []))) - (def: (on-write input [open? state]) + (exception.throw ..console_is_closed! []))) + (def: (on_write input [open? state]) (if open? (#try.Success [open? (format state input)]) - (exception.throw ..console-is-closed! []))) - (def: (on-close [open? buffer]) + (exception.throw ..console_is_closed! []))) + (def: (on_close [open? buffer]) (if open? (#try.Success [false buffer]) - (exception.throw ..console-is-closed! [])))) + (exception.throw ..console_is_closed! [])))) (def: #export echo (-> Text (Console Promise)) @@ -71,7 +71,7 @@ [#let [console (..echo "")] verdict (do (try.with promise.monad) [_ (/.do! console profile) - logging (!.use (\ console read-line) [])] + logging (!.use (\ console read_line) [])] (wrap (text\= (version.format language/lux.version) logging)))] (_.cover' [/.do!] |