diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/world/file.lux | 40 |
1 files changed, 20 insertions, 20 deletions
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)) |