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.lux114
1 files changed, 57 insertions, 57 deletions
diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux
index 5c633a048..d1d1d175b 100644
--- a/stdlib/source/test/lux/world/file.lux
+++ b/stdlib/source/test/lux/world/file.lux
@@ -43,9 +43,9 @@
[#let [check-existence! (: (IO (Try Bit))
(try.lift io.monad (/.exists? io.monad /.default path)))]
pre! check-existence!
- file (!.use (:: /.default create-file) path)
+ file (!.use (\ /.default create-file) path)
post! check-existence!
- _ (!.use (:: file delete) [])
+ _ (!.use (\ file delete) [])
remains? check-existence!]
(wrap (and (not pre!)
post!
@@ -59,11 +59,11 @@
[#let [path (format "temp_file_" (%.nat number))]
result (promise.future
(do (try.with io.monad)
- [file (!.use (:: /.default create-file) path)
- _ (!.use (:: file over-write) data)
- content (!.use (:: file content) [])
- _ (!.use (:: file delete) [])]
- (wrap (:: binary.equivalence = data content))))]
+ [file (!.use (\ /.default create-file) path)
+ _ (!.use (\ file over-write) data)
+ content (!.use (\ file content) [])
+ _ (!.use (\ file delete) [])]
+ (wrap (\ binary.equivalence = data content))))]
(_.assert "Can write/read files."
(try.default #0 result)))))
@@ -71,14 +71,14 @@
Test
(<| (_.context (%.name (name-of /._)))
(do {! r.monad}
- [file-size (|> r.nat (:: ! map (|>> (n.% 100) (n.max 10))))
+ [file-size (|> r.nat (\ ! map (|>> (n.% 100) (n.max 10))))
dataL (_binary.random file-size)
dataR (_binary.random file-size)
- new-modified (|> r.int (:: ! map (|>> i.abs
- (i.% +10,000,000,000,000)
- truncate-millis
- duration.from-millis
- instant.absolute)))]
+ new-modified (|> r.int (\ ! map (|>> i.abs
+ (i.% +10,000,000,000,000)
+ truncate-millis
+ duration.from-millis
+ instant.absolute)))]
($_ _.and
(..creation-and-deletion 0)
(..read-and-write 1 dataL)
@@ -87,10 +87,10 @@
[#let [path "temp_file_2"]
result (promise.future
(do (try.with io.monad)
- [file (!.use (:: /.default create-file) path)
- _ (!.use (:: file over-write) dataL)
- read-size (!.use (:: file size) [])
- _ (!.use (:: file delete) [])]
+ [file (!.use (\ /.default create-file) path)
+ _ (!.use (\ file over-write) dataL)
+ read-size (!.use (\ file size) [])
+ _ (!.use (\ file delete) [])]
(wrap (n.= file-size read-size))))]
(_.assert "Can read file size."
(try.default #0 result))))
@@ -98,19 +98,19 @@
[#let [path "temp_file_3"]
result (promise.future
(do (try.with io.monad)
- [file (!.use (:: /.default create-file) path)
- _ (!.use (:: file over-write) dataL)
- _ (!.use (:: file append) dataR)
- content (!.use (:: file content) [])
- read-size (!.use (:: file size) [])
- _ (!.use (:: file delete) [])]
+ [file (!.use (\ /.default create-file) path)
+ _ (!.use (\ file over-write) dataL)
+ _ (!.use (\ file append) dataR)
+ content (!.use (\ file content) [])
+ read-size (!.use (\ file size) [])
+ _ (!.use (\ file delete) [])]
(wrap (and (n.= (n.* 2 file-size) read-size)
- (:: binary.equivalence =
- dataL
- (try.assume (binary.slice 0 (dec file-size) content)))
- (:: binary.equivalence =
- dataR
- (try.assume (binary.slice file-size (dec read-size) content)))))))]
+ (\ binary.equivalence =
+ dataL
+ (try.assume (binary.slice 0 (dec file-size) content)))
+ (\ binary.equivalence =
+ dataR
+ (try.assume (binary.slice file-size (dec read-size) content)))))))]
(_.assert "Can append to files."
(try.default #0 result))))
(wrap (do promise.monad
@@ -120,9 +120,9 @@
[#let [check-existence! (: (IO (Try Bit))
(try.lift io.monad (/.exists? io.monad /.default path)))]
pre! check-existence!
- dir (!.use (:: /.default create-directory) path)
+ dir (!.use (\ /.default create-directory) path)
post! check-existence!
- _ (!.use (:: dir discard) [])
+ _ (!.use (\ dir discard) [])
remains? check-existence!]
(wrap (and (not pre!)
post!
@@ -134,12 +134,12 @@
dir-path "temp_dir_5"]
result (promise.future
(do (try.with io.monad)
- [dir (!.use (:: /.default create-directory) dir-path)
- file (!.use (:: /.default create-file) (format dir-path "/" file-path))
- _ (!.use (:: file over-write) dataL)
- read-size (!.use (:: file size) [])
- _ (!.use (:: file delete) [])
- _ (!.use (:: dir discard) [])]
+ [dir (!.use (\ /.default create-directory) dir-path)
+ file (!.use (\ /.default create-file) (format dir-path "/" file-path))
+ _ (!.use (\ file over-write) dataL)
+ read-size (!.use (\ file size) [])
+ _ (!.use (\ file delete) [])
+ _ (!.use (\ dir discard) [])]
(wrap (n.= file-size read-size))))]
(_.assert "Can create files inside of directories."
(try.default #0 result))))
@@ -149,18 +149,18 @@
inner-dir-path "inner_temp_dir_6"]
result (promise.future
(do (try.with io.monad)
- [dir (!.use (:: /.default create-directory) dir-path)
- pre-files (!.use (:: dir files) [])
- pre-directories (!.use (:: dir directories) [])
+ [dir (!.use (\ /.default create-directory) dir-path)
+ pre-files (!.use (\ dir files) [])
+ pre-directories (!.use (\ dir directories) [])
- file (!.use (:: /.default create-file) (format dir-path "/" file-path))
- inner-dir (!.use (:: /.default create-directory) (format dir-path "/" inner-dir-path))
- post-files (!.use (:: dir files) [])
- post-directories (!.use (:: dir directories) [])
+ file (!.use (\ /.default create-file) (format dir-path "/" file-path))
+ inner-dir (!.use (\ /.default create-directory) (format dir-path "/" inner-dir-path))
+ post-files (!.use (\ dir files) [])
+ post-directories (!.use (\ dir directories) [])
- _ (!.use (:: file delete) [])
- _ (!.use (:: inner-dir discard) [])
- _ (!.use (:: dir discard) [])]
+ _ (!.use (\ file delete) [])
+ _ (!.use (\ inner-dir discard) [])
+ _ (!.use (\ dir discard) [])]
(wrap (and (and (n.= 0 (list.size pre-files))
(n.= 0 (list.size pre-directories)))
(and (n.= 1 (list.size post-files))
@@ -171,12 +171,12 @@
[#let [path "temp_file_7"]
result (promise.future
(do (try.with io.monad)
- [file (!.use (:: /.default create-file) path)
- _ (!.use (:: file over-write) dataL)
- _ (!.use (:: file modify) new-modified)
- current-modified (!.use (:: file last-modified) [])
- _ (!.use (:: file delete) [])]
- (wrap (:: instant.equivalence = new-modified current-modified))))]
+ [file (!.use (\ /.default create-file) path)
+ _ (!.use (\ file over-write) dataL)
+ _ (!.use (\ file modify) new-modified)
+ current-modified (!.use (\ file last-modified) [])
+ _ (!.use (\ file delete) [])]
+ (wrap (\ instant.equivalence = new-modified current-modified))))]
(_.assert "Can change the time of last modification."
(try.default #0 result))))
(wrap (do promise.monad
@@ -187,14 +187,14 @@
[#let [check-existence! (: (-> Path (IO (Try Bit)))
(|>> (/.exists? io.monad /.default)
(try.lift io.monad)))]
- file0 (!.use (:: /.default create-file) path0)
- _ (!.use (:: file0 over-write) dataL)
+ file0 (!.use (\ /.default create-file) path0)
+ _ (!.use (\ file0 over-write) dataL)
pre! (check-existence! path0)
file1 (: (IO (Try (File IO))) ## TODO: Remove :
- (!.use (:: file0 move) path1))
+ (!.use (\ file0 move) path1))
post! (check-existence! path0)
confirmed? (check-existence! path1)
- _ (!.use (:: file1 delete) [])]
+ _ (!.use (\ file1 delete) [])]
(wrap (and pre!
(not post!)
confirmed?))))]