From 4ca397765805eda5ddee393901ed3a02001a960a Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 25 Dec 2020 09:22:38 -0400 Subject: Replaced kebab-case with snake_case for naming convention. --- stdlib/source/test/aedifex/command/clean.lux | 86 ++++++++++++++-------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'stdlib/source/test/aedifex/command/clean.lux') 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)))) -- cgit v1.2.3