diff options
author | Eduardo Julian | 2022-08-11 04:15:07 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-08-11 04:15:07 -0400 |
commit | 065e8a4d8122d4616b570496915d2c0e2c78cd6b (patch) | |
tree | f2bbdc3e40b796b34026ab04c9a478d8a3f082d5 /stdlib/source/test/lux/world | |
parent | 68d78235694c633c956bb9e8a007cad7d65370bc (diff) |
Re-named the "case" macro to "when".
Diffstat (limited to 'stdlib/source/test/lux/world')
-rw-r--r-- | stdlib/source/test/lux/world/environment.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/file.lux | 40 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/file/watch.lux | 12 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/net/http/client.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/shell.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/time.lux | 8 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/time/date.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/time/day.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/time/instant.lux | 2 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/time/month.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/time/year.lux | 6 |
11 files changed, 46 insertions, 46 deletions
diff --git a/stdlib/source/test/lux/world/environment.lux b/stdlib/source/test/lux/world/environment.lux index c2a9ac384..df434f657 100644 --- a/stdlib/source/test/lux/world/environment.lux +++ b/stdlib/source/test/lux/world/environment.lux @@ -54,7 +54,7 @@ (do random.monad [property (random.alphabetic 1)] (_.coverage [\\parser.unknown_property] - (case (\\parser.result (\\parser.property property) \\parser.empty) + (when (\\parser.result (\\parser.property property) \\parser.empty) {try.#Success _} false @@ -104,7 +104,7 @@ (|> unknown (at it variable) io.run! - (pipe.case {try.#Success _} + (pipe.when {try.#Success _} false {try.#Failure error} diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index 3eec4fa19..477b09110 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -41,7 +41,7 @@ (-> (Atom Disk) (-> /.Path (IO Bit))) (do io.monad [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#None} false {.#Some {.#Left _}} true {.#Some {.#Right _}} false)))) @@ -50,7 +50,7 @@ (-> (Atom Disk) (-> /.Path (IO Bit))) (do io.monad [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#None} false {.#Some {.#Left _}} false {.#Some {.#Right _}} true)))) @@ -61,7 +61,7 @@ (-> /.Path (IO (Try Any)))) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#Some {.#Right siblings}} (do ! [_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Right (alert siblings)} disk') disk)] @@ -75,12 +75,12 @@ (do [! io.monad] [now instant.now disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') (^.or {.#None} {.#Some {.#Left _}}) (do ! [_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Left [now it]} disk') disk)] - (case (/.parent fs @) + (when (/.parent fs @) {.#Some parent} (alert_parent! disk (|>> (list.partial @)) parent) @@ -94,7 +94,7 @@ (-> (Atom Disk) (-> /.Path (IO (Try Binary)))) (do io.monad [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#Some {.#Left [_ it]}} {try.#Success it} @@ -106,7 +106,7 @@ (-> /.Path (IO (Try Any)))) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#Some {.#Right children}} (if (list.empty? children) (do ! @@ -117,7 +117,7 @@ {.#Some {.#Left [_ data]}} (do ! [_ (atom.compare_and_swap! disk' (dictionary.lacks @ disk') disk)] - (case (/.parent fs @) + (when (/.parent fs @) {.#Some parent} (alert_parent! disk (list.only (|>> (text#= @) not)) parent) @@ -144,7 +144,7 @@ (def (file_size @) (do [! io.monad] [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#Some {.#Left [_ it]}} {try.#Success (binary.size it)} @@ -153,7 +153,7 @@ (def (last_modified @) (do [! io.monad] [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#Some {.#Left [it _]}} {try.#Success it} @@ -162,7 +162,7 @@ (def (can_execute? @) (do [! io.monad] [disk (atom.read! disk)] - (in (case (dictionary.value @ disk) + (in (when (dictionary.value @ disk) {.#Some {.#Left _}} {try.#Success false} @@ -172,11 +172,11 @@ (def (make_directory @) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#None} (do ! [_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Right (list)} disk') disk)] - (case (/.parent mock @) + (when (/.parent mock @) {.#Some parent} (alert_parent! disk (|>> (list.partial @)) parent) @@ -188,7 +188,7 @@ (def (directory_files @) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#Some {.#Right children}} (|> children (monad.only ! (..file? disk)) @@ -199,7 +199,7 @@ (def (sub_directories @) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#Some {.#Right children}} (|> children (monad.only ! (..directory? disk)) @@ -211,7 +211,7 @@ (do [! io.monad] [now instant.now disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#None} (..write mock disk @ it) @@ -227,7 +227,7 @@ (def (modify @ it) (do [! io.monad] [disk' (atom.read! disk)] - (case (dictionary.value @ disk') + (when (dictionary.value @ disk') {.#Some {.#Left [_ data]}} (do ! [_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Left [it data]} disk') disk)] @@ -258,7 +258,7 @@ [.let [fs (/.mock /)] ? (at fs delete file)] (unit.coverage [/.cannot_delete] - (case ? + (when ? {try.#Failure error} (exception.match? /.cannot_delete error) @@ -268,7 +268,7 @@ [.let [fs (/.mock /)] ? (at fs read file)] (unit.coverage [/.cannot_find_file] - (case ? + (when ? {try.#Failure error} (exception.match? /.cannot_find_file error) @@ -279,7 +279,7 @@ ?/0 (at fs directory_files file) ?/1 (at fs sub_directories file)] (unit.coverage [/.cannot_find_directory] - (case [?/0 ?/1] + (when [?/0 ?/1] [{try.#Failure error/0} {try.#Failure error/1}] (and (exception.match? /.cannot_find_directory error/0) (exception.match? /.cannot_find_directory error/1)) diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index 73f7755ca..e8ce8182e 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -77,13 +77,13 @@ [?concern (at watcher concern directory) ?stop (at watcher stop directory)] (unit.coverage [/.not_being_watched] - (and (case ?concern + (and (when ?concern {try.#Failure error} (exception.match? /.not_being_watched error) {try.#Success _} false) - (case ?stop + (when ?stop {try.#Failure error} (exception.match? /.not_being_watched error) @@ -106,7 +106,7 @@ (//.make_file async.monad fs (binary.empty 0) expected_path)) poll/pre (at watcher poll []) poll/post (at watcher poll [])] - (in (and (case poll/pre + (in (and (when poll/pre (list [concern actual_path]) (and (text#= expected_path actual_path) (and (/.creation? concern) @@ -124,7 +124,7 @@ _ (at fs write expected_path data) poll/2 (at watcher poll []) poll/2' (at watcher poll [])] - (in (and (case poll/2 + (in (and (when poll/2 (list [concern actual_path]) (and (text#= expected_path actual_path) (and (not (/.creation? concern)) @@ -141,7 +141,7 @@ [_ (at fs delete expected_path) poll/3 (at watcher poll []) poll/3' (at watcher poll [])] - (in (and (case poll/3 + (in (and (when poll/3 (list [concern actual_path]) (and (not (/.creation? concern)) (not (/.modification? concern)) @@ -193,7 +193,7 @@ (in (do async.monad [started? (at watcher start /.all directory)] (unit.coverage [/.cannot_poll_a_non_existent_directory] - (case started? + (when started? {try.#Success _} false diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index 01bd03616..aa8ed3b58 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -37,7 +37,7 @@ (! Bit))) (do ! [response response] - (case response + (when response {try.#Success response} (|> response product.right @@ -72,7 +72,7 @@ .let [mock (is (/.Client IO) (implementation (def (request method url headers data) - (io.io (let [value (case method + (io.io (let [value (when method {//.#Post} on_post {//.#Get} on_get {//.#Put} on_put diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index 8b3da3a10..ce6b1b984 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -105,7 +105,7 @@ failure (at process fail []) wrote! (do ! [write (at process write input)] - (in {try.#Success (case write + (in {try.#Success (when write {try.#Success _} false @@ -113,7 +113,7 @@ (text#= input write))})) destroyed! (do ! [destroy (at process destroy [])] - (in {try.#Success (case destroy + (in {try.#Success (when destroy {try.#Success _} false diff --git a/stdlib/source/test/lux/world/time.lux b/stdlib/source/test/lux/world/time.lux index 6e3bbff5b..4ca58afca 100644 --- a/stdlib/source/test/lux/world/time.lux +++ b/stdlib/source/test/lux/world/time.lux @@ -76,7 +76,7 @@ (text.prefix <prefix>) (text.suffix <suffix>) (at /.codec decoded) - (pipe.case + (pipe.when {try.#Success _} true {try.#Failure error} false)) @@ -86,7 +86,7 @@ (text.prefix <prefix>) (text.suffix <suffix>) (at /.codec decoded) - (pipe.case + (pipe.when {try.#Success _} false @@ -104,7 +104,7 @@ %.nat (format "00:00:00.") (at /.codec decoded) - (pipe.case + (pipe.when {try.#Success _} true {try.#Failure error} false))) )))) @@ -129,7 +129,7 @@ (try#each (at /.equivalence = expected)) (try.else false))) (_.coverage [/.time_exceeds_a_day] - (case (/.of_millis out_of_bounds) + (when (/.of_millis out_of_bounds) {try.#Success _} false diff --git a/stdlib/source/test/lux/world/time/date.lux b/stdlib/source/test/lux/world/time/date.lux index e6887f9e0..3dd22343b 100644 --- a/stdlib/source/test/lux/world/time/date.lux +++ b/stdlib/source/test/lux/world/time/date.lux @@ -50,7 +50,7 @@ (do random.monad [expected random.date] (_.coverage [/.invalid_day] - (case (/.date (/.year expected) + (when (/.date (/.year expected) (/.month expected) (n.+ 31 (/.day_of_month expected))) {try.#Failure error} @@ -87,7 +87,7 @@ "-" (%.nat month) "-" (%.nat day))]] (_.coverage [/.invalid_month] - (case (<text>.result /.parser input) + (when (<text>.result /.parser input) {try.#Failure error} (exception.match? /.invalid_month error) diff --git a/stdlib/source/test/lux/world/time/day.lux b/stdlib/source/test/lux/world/time/day.lux index f69727234..c6471ffae 100644 --- a/stdlib/source/test/lux/world/time/day.lux +++ b/stdlib/source/test/lux/world/time/day.lux @@ -61,7 +61,7 @@ (do random.monad [not_a_day (random.upper_case 1)] (_.coverage [/.not_a_day_of_the_week] - (case (at /.codec decoded not_a_day) + (when (at /.codec decoded not_a_day) {try.#Failure error} (exception.match? /.not_a_day_of_the_week error) @@ -74,7 +74,7 @@ (try#each (at /.equivalence = expected)) (try.else false))) (_.coverage [/.invalid_day] - (case (/.by_number invalid) + (when (/.by_number invalid) {try.#Failure error} (exception.match? /.invalid_day error) diff --git a/stdlib/source/test/lux/world/time/instant.lux b/stdlib/source/test/lux/world/time/instant.lux index cebba07ff..32b4c71f3 100644 --- a/stdlib/source/test/lux/world/time/instant.lux +++ b/stdlib/source/test/lux/world/time/instant.lux @@ -98,7 +98,7 @@ (apply duration.inverse day#pred 6) (apply duration.inverse day#pred 7))))) (_.coverage [/.now] - (case (try (io.run! /.now)) + (when (try (io.run! /.now)) {try.#Success _} true diff --git a/stdlib/source/test/lux/world/time/month.lux b/stdlib/source/test/lux/world/time/month.lux index e7b5f09a2..29117b8d3 100644 --- a/stdlib/source/test/lux/world/time/month.lux +++ b/stdlib/source/test/lux/world/time/month.lux @@ -65,7 +65,7 @@ (try#each (at /.equivalence = expected)) (try.else false))) (_.coverage [/.invalid_month] - (case (/.by_number invalid) + (when (/.by_number invalid) {try.#Failure error} (exception.match? /.invalid_month error) @@ -93,7 +93,7 @@ (do random.monad [not_a_month (random.upper_case 1)] (_.coverage [/.not_a_month_of_the_year] - (case (at /.codec decoded not_a_month) + (when (at /.codec decoded not_a_month) {try.#Failure error} (exception.match? /.not_a_month_of_the_year error) diff --git a/stdlib/source/test/lux/world/time/year.lux b/stdlib/source/test/lux/world/time/year.lux index 32c19dccf..ec4638abd 100644 --- a/stdlib/source/test/lux/world/time/year.lux +++ b/stdlib/source/test/lux/world/time/year.lux @@ -49,14 +49,14 @@ (all _.and (_.coverage [/.year] (bit#= (i.= +0 expected) - (case (/.year expected) + (when (/.year expected) {try.#Success _} false {try.#Failure _} true))) (_.coverage [/.value] - (case (/.year expected) + (when (/.year expected) {try.#Success year} (i.= expected (/.value year)) @@ -64,7 +64,7 @@ (i.= +0 expected))) )) (_.coverage [/.there_is_no_year_0] - (case (/.year +0) + (when (/.year +0) {try.#Success _} false |