aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/world/file.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/world/file.lux')
-rw-r--r--stdlib/source/test/lux/world/file.lux39
1 files changed, 37 insertions, 2 deletions
diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux
index ee313599f..5c05b5437 100644
--- a/stdlib/source/test/lux/world/file.lux
+++ b/stdlib/source/test/lux/world/file.lux
@@ -7,8 +7,9 @@
[control
["[0]" io {"+" IO}]
["[0]" try {"+" Try}]
+ ["[0]" exception]
[concurrency
- [async {"+" Async}]
+ ["[0]" async {"+" Async}]
["[0]" atom {"+" Atom}]]]
[data
["[0]" binary {"+" Binary} ("[1]#[0]" monoid)]
@@ -239,12 +240,46 @@
Test
(<| (_.covering /._)
(do [! random.monad]
- [/ (random.ascii/upper 1)]
+ [/ (random.ascii/upper 1)
+ file (random.ascii/lower 1)]
($_ _.and
(_.for [/.mock]
($/.spec (io.io (/.mock /))))
(_.for [/.async]
($/.spec (io.io (/.async (..fs /)))))
+
+ (in (do async.monad
+ [.let [fs (/.mock /)]
+ ? (# fs delete file)]
+ (_.cover' [/.cannot_delete]
+ (case ?
+ {try.#Failure error}
+ (exception.match? /.cannot_delete error)
+
+ _
+ false))))
+ (in (do async.monad
+ [.let [fs (/.mock /)]
+ ? (# fs read file)]
+ (_.cover' [/.cannot_find_file]
+ (case ?
+ {try.#Failure error}
+ (exception.match? /.cannot_find_file error)
+
+ _
+ false))))
+ (in (do async.monad
+ [.let [fs (/.mock /)]
+ ?/0 (# fs directory_files file)
+ ?/1 (# fs sub_directories file)]
+ (_.cover' [/.cannot_find_directory]
+ (case [?/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))
+
+ _
+ false))))
/watch.test
))))