aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data/format/tar.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-04-08 05:42:36 -0400
committerEduardo Julian2022-04-08 05:42:36 -0400
commit0d909187d5b9effcd08f533d50af7d29c0d6bfd8 (patch)
treec50f12c5e47e3db90c3a701b54ee9953da942210 /stdlib/source/test/lux/data/format/tar.lux
parente5e4c2aff562e5c01fefb808d1d68a40f29c9cc5 (diff)
De-sigil-ification: $
Diffstat (limited to 'stdlib/source/test/lux/data/format/tar.lux')
-rw-r--r--stdlib/source/test/lux/data/format/tar.lux600
1 files changed, 300 insertions, 300 deletions
diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux
index d38efe7ec..1bffe48ec 100644
--- a/stdlib/source/test/lux/data/format/tar.lux
+++ b/stdlib/source/test/lux/data/format/tar.lux
@@ -44,32 +44,32 @@
invalid (random.ascii/lower (++ /.path_size))
not_ascii (random.text (random.char (unicode.set [unicode/block.katakana (list)]))
/.path_size)]
- (`` ($_ _.and
- (_.cover [/.path /.from_path]
- (case (/.path expected)
- {try.#Success actual}
- (text#= expected
- (/.from_path actual))
-
- {try.#Failure error}
- false))
- (_.cover [/.no_path]
- (text#= "" (/.from_path /.no_path)))
- (_.cover [/.path_size /.path_is_too_long]
- (case (/.path invalid)
- {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.path_is_too_long error)))
- (_.cover [/.not_ascii]
- (case (/.path not_ascii)
- {try.#Success actual}
- false
-
- {try.#Failure error}
- (exception.match? /.not_ascii error)))
- )))))
+ (`` (all _.and
+ (_.cover [/.path /.from_path]
+ (case (/.path expected)
+ {try.#Success actual}
+ (text#= expected
+ (/.from_path actual))
+
+ {try.#Failure error}
+ false))
+ (_.cover [/.no_path]
+ (text#= "" (/.from_path /.no_path)))
+ (_.cover [/.path_size /.path_is_too_long]
+ (case (/.path invalid)
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.path_is_too_long error)))
+ (_.cover [/.not_ascii]
+ (case (/.path not_ascii)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_ascii error)))
+ )))))
(def: name
Test
@@ -79,30 +79,30 @@
invalid (random.ascii/lower (++ /.name_size))
not_ascii (random.text (random.char (unicode.set [unicode/block.katakana (list)]))
/.name_size)]
- (`` ($_ _.and
- (_.cover [/.name /.from_name]
- (case (/.name expected)
- {try.#Success actual}
- (text#= expected
- (/.from_name actual))
-
- {try.#Failure error}
- false))
- (_.cover [/.name_size /.name_is_too_long]
- (case (/.name invalid)
- {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.name_is_too_long error)))
- (_.cover [/.not_ascii]
- (case (/.name not_ascii)
- {try.#Success actual}
- false
-
- {try.#Failure error}
- (exception.match? /.not_ascii error)))
- )))))
+ (`` (all _.and
+ (_.cover [/.name /.from_name]
+ (case (/.name expected)
+ {try.#Success actual}
+ (text#= expected
+ (/.from_name actual))
+
+ {try.#Failure error}
+ false))
+ (_.cover [/.name_size /.name_is_too_long]
+ (case (/.name invalid)
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.name_is_too_long error)))
+ (_.cover [/.not_ascii]
+ (case (/.name not_ascii)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_ascii error)))
+ )))))
(def: small
Test
@@ -110,23 +110,23 @@
(do [! random.monad]
[expected (|> random.nat (# ! each (n.% /.small_limit)))
invalid (|> random.nat (# ! each (n.max /.small_limit)))]
- (`` ($_ _.and
- (_.cover [/.small /.from_small]
- (case (/.small expected)
- {try.#Success actual}
- (n.= expected
- (/.from_small actual))
-
- {try.#Failure error}
- false))
- (_.cover [/.small_limit /.not_a_small_number]
- (case (/.small invalid)
- {try.#Success actual}
- false
-
- {try.#Failure error}
- (exception.match? /.not_a_small_number error)))
- )))))
+ (`` (all _.and
+ (_.cover [/.small /.from_small]
+ (case (/.small expected)
+ {try.#Success actual}
+ (n.= expected
+ (/.from_small actual))
+
+ {try.#Failure error}
+ false))
+ (_.cover [/.small_limit /.not_a_small_number]
+ (case (/.small invalid)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_a_small_number error)))
+ )))))
(def: big
Test
@@ -134,23 +134,23 @@
(do [! random.monad]
[expected (|> random.nat (# ! each (n.% /.big_limit)))
invalid (|> random.nat (# ! each (n.max /.big_limit)))]
- (`` ($_ _.and
- (_.cover [/.big /.from_big]
- (case (/.big expected)
- {try.#Success actual}
- (n.= expected
- (/.from_big actual))
-
- {try.#Failure error}
- false))
- (_.cover [/.big_limit /.not_a_big_number]
- (case (/.big invalid)
- {try.#Success actual}
- false
-
- {try.#Failure error}
- (exception.match? /.not_a_big_number error)))
- )))))
+ (`` (all _.and
+ (_.cover [/.big /.from_big]
+ (case (/.big expected)
+ {try.#Success actual}
+ (n.= expected
+ (/.from_big actual))
+
+ {try.#Failure error}
+ false))
+ (_.cover [/.big_limit /.not_a_big_number]
+ (case (/.big invalid)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_a_big_number error)))
+ )))))
(def: chunk_size 32)
@@ -166,61 +166,61 @@
(list.repeated chunks)
text.together
(# utf8.codec encoded))]]
- (`` ($_ _.and
- (~~ (template [<type> <tag>]
- [(_.cover [<type>]
- (|> (do try.monad
- [expected_path (/.path expected_path)
- tar (|> (sequence.sequence {<tag> expected_path})
- (format.result /.writer)
- (<b>.result /.parser))]
- (in (case (sequence.list tar)
- (pattern (list {<tag> actual_path}))
- (text#= (/.from_path expected_path)
- (/.from_path actual_path))
-
- _
- false)))
- (try.else false)))]
-
- [/.Symbolic_Link /.#Symbolic_Link]
- [/.Directory /.#Directory]
- ))
- (_.for [/.File /.Content /.content /.data]
- ($_ _.and
- (~~ (template [<type> <tag>]
- [(_.cover [<type>]
- (|> (do try.monad
- [expected_path (/.path expected_path)
- expected_content (/.content content)
- tar (|> (sequence.sequence {<tag> [expected_path
- expected_moment
- /.none
- [/.#user [/.#name /.anonymous
- /.#id /.no_id]
- /.#group [/.#name /.anonymous
- /.#id /.no_id]]
- expected_content]})
- (format.result /.writer)
- (<b>.result /.parser))]
- (in (case (sequence.list tar)
- (pattern (list {<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]}))
- (let [seconds (is (-> Instant Int)
- (|>> instant.relative (duration.ticks duration.second)))]
- (and (text#= (/.from_path expected_path)
- (/.from_path actual_path))
- (i.= (seconds expected_moment)
- (seconds actual_moment))
- (binary#= (/.data expected_content)
- (/.data actual_content))))
-
- _
- false)))
- (try.else false)))]
-
- [/.Normal /.#Normal]
- [/.Contiguous /.#Contiguous]
- ))))))))
+ (`` (all _.and
+ (~~ (template [<type> <tag>]
+ [(_.cover [<type>]
+ (|> (do try.monad
+ [expected_path (/.path expected_path)
+ tar (|> (sequence.sequence {<tag> expected_path})
+ (format.result /.writer)
+ (<b>.result /.parser))]
+ (in (case (sequence.list tar)
+ (pattern (list {<tag> actual_path}))
+ (text#= (/.from_path expected_path)
+ (/.from_path actual_path))
+
+ _
+ false)))
+ (try.else false)))]
+
+ [/.Symbolic_Link /.#Symbolic_Link]
+ [/.Directory /.#Directory]
+ ))
+ (_.for [/.File /.Content /.content /.data]
+ (all _.and
+ (~~ (template [<type> <tag>]
+ [(_.cover [<type>]
+ (|> (do try.monad
+ [expected_path (/.path expected_path)
+ expected_content (/.content content)
+ tar (|> (sequence.sequence {<tag> [expected_path
+ expected_moment
+ /.none
+ [/.#user [/.#name /.anonymous
+ /.#id /.no_id]
+ /.#group [/.#name /.anonymous
+ /.#id /.no_id]]
+ expected_content]})
+ (format.result /.writer)
+ (<b>.result /.parser))]
+ (in (case (sequence.list tar)
+ (pattern (list {<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]}))
+ (let [seconds (is (-> Instant Int)
+ (|>> instant.relative (duration.ticks duration.second)))]
+ (and (text#= (/.from_path expected_path)
+ (/.from_path actual_path))
+ (i.= (seconds expected_moment)
+ (seconds actual_moment))
+ (binary#= (/.data expected_content)
+ (/.data actual_content))))
+
+ _
+ false)))
+ (try.else false)))]
+
+ [/.Normal /.#Normal]
+ [/.Contiguous /.#Contiguous]
+ ))))))))
(def: random_mode
(Random /.Mode)
@@ -246,71 +246,71 @@
[path (random.ascii/lower 10)
modes (random.list 4 ..random_mode)
.let [expected_mode (list#mix /.and /.none modes)]]
- (`` ($_ _.and
- (_.cover [/.and]
- (|> (do try.monad
- [path (/.path path)
- content (/.content (binary.empty 0))
- tar (|> (sequence.sequence {/.#Normal [path
- (instant.of_millis +0)
- expected_mode
- [/.#user [/.#name /.anonymous
- /.#id /.no_id]
- /.#group [/.#name /.anonymous
- /.#id /.no_id]]
- content]})
- (format.result /.writer)
- (<b>.result /.parser))]
- (in (case (sequence.list tar)
- (pattern (list {/.#Normal [_ _ actual_mode _ _]}))
- (n.= (/.mode expected_mode)
- (/.mode actual_mode))
-
- _
- false)))
- (try.else false)))
- (~~ (template [<expected_mode>]
- [(_.cover [<expected_mode>]
- (|> (do try.monad
- [path (/.path path)
- content (/.content (binary.empty 0))
- tar (|> (sequence.sequence {/.#Normal [path
- (instant.of_millis +0)
- <expected_mode>
- [/.#user [/.#name /.anonymous
- /.#id /.no_id]
- /.#group [/.#name /.anonymous
- /.#id /.no_id]]
- content]})
- (format.result /.writer)
- (<b>.result /.parser))]
- (in (case (sequence.list tar)
- (pattern (list {/.#Normal [_ _ actual_mode _ _]}))
- (n.= (/.mode <expected_mode>)
- (/.mode actual_mode))
-
- _
- false)))
- (try.else false)))]
-
- [/.none]
-
- [/.execute_by_other]
- [/.write_by_other]
- [/.read_by_other]
-
- [/.execute_by_group]
- [/.write_by_group]
- [/.read_by_group]
-
- [/.execute_by_owner]
- [/.write_by_owner]
- [/.read_by_owner]
-
- [/.save_text]
- [/.set_group_id_on_execution]
- [/.set_user_id_on_execution]
- )))))))
+ (`` (all _.and
+ (_.cover [/.and]
+ (|> (do try.monad
+ [path (/.path path)
+ content (/.content (binary.empty 0))
+ tar (|> (sequence.sequence {/.#Normal [path
+ (instant.of_millis +0)
+ expected_mode
+ [/.#user [/.#name /.anonymous
+ /.#id /.no_id]
+ /.#group [/.#name /.anonymous
+ /.#id /.no_id]]
+ content]})
+ (format.result /.writer)
+ (<b>.result /.parser))]
+ (in (case (sequence.list tar)
+ (pattern (list {/.#Normal [_ _ actual_mode _ _]}))
+ (n.= (/.mode expected_mode)
+ (/.mode actual_mode))
+
+ _
+ false)))
+ (try.else false)))
+ (~~ (template [<expected_mode>]
+ [(_.cover [<expected_mode>]
+ (|> (do try.monad
+ [path (/.path path)
+ content (/.content (binary.empty 0))
+ tar (|> (sequence.sequence {/.#Normal [path
+ (instant.of_millis +0)
+ <expected_mode>
+ [/.#user [/.#name /.anonymous
+ /.#id /.no_id]
+ /.#group [/.#name /.anonymous
+ /.#id /.no_id]]
+ content]})
+ (format.result /.writer)
+ (<b>.result /.parser))]
+ (in (case (sequence.list tar)
+ (pattern (list {/.#Normal [_ _ actual_mode _ _]}))
+ (n.= (/.mode <expected_mode>)
+ (/.mode actual_mode))
+
+ _
+ false)))
+ (try.else false)))]
+
+ [/.none]
+
+ [/.execute_by_other]
+ [/.write_by_other]
+ [/.read_by_other]
+
+ [/.execute_by_group]
+ [/.write_by_group]
+ [/.read_by_group]
+
+ [/.execute_by_owner]
+ [/.write_by_owner]
+ [/.read_by_owner]
+
+ [/.save_text]
+ [/.set_group_id_on_execution]
+ [/.set_user_id_on_execution]
+ )))))))
(def: ownership
Test
@@ -321,75 +321,75 @@
not_ascii (random.text (random.char (unicode.set [unicode/block.katakana (list)]))
/.name_size)]
(_.for [/.Ownership /.Owner /.ID]
- ($_ _.and
- (_.cover [/.name_size /.name_is_too_long]
- (case (/.name invalid)
- {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.name_is_too_long error)))
- (_.cover [/.not_ascii]
- (case (/.name not_ascii)
- {try.#Success actual}
- false
-
- {try.#Failure error}
- (exception.match? /.not_ascii error)))
- (_.cover [/.Name /.name /.from_name]
- (|> (do try.monad
- [path (/.path path)
- content (/.content (binary.empty 0))
- expected (/.name expected)
- tar (|> (sequence.sequence {/.#Normal [path
- (instant.of_millis +0)
- /.none
- [/.#user [/.#name expected
- /.#id /.no_id]
- /.#group [/.#name /.anonymous
- /.#id /.no_id]]
- content]})
- (format.result /.writer)
- (<b>.result /.parser))]
- (in (case (sequence.list tar)
- (pattern (list {/.#Normal [_ _ _ actual_ownership _]}))
- (and (text#= (/.from_name expected)
- (/.from_name (the [/.#user /.#name] actual_ownership)))
- (text#= (/.from_name /.anonymous)
- (/.from_name (the [/.#group /.#name] actual_ownership))))
-
- _
- false)))
- (try.else false)))
- (_.cover [/.anonymous /.no_id]
- (|> (do try.monad
- [path (/.path path)
- content (/.content (binary.empty 0))
- tar (|> (sequence.sequence {/.#Normal [path
- (instant.of_millis +0)
- /.none
- [/.#user [/.#name /.anonymous
- /.#id /.no_id]
- /.#group [/.#name /.anonymous
- /.#id /.no_id]]
- content]})
- (format.result /.writer)
- (<b>.result /.parser))]
- (in (case (sequence.list tar)
- (pattern (list {/.#Normal [_ _ _ actual_ownership _]}))
- (and (text#= (/.from_name /.anonymous)
- (/.from_name (the [/.#user /.#name] actual_ownership)))
- (n.= (/.from_small /.no_id)
- (/.from_small (the [/.#user /.#id] actual_ownership)))
- (text#= (/.from_name /.anonymous)
- (/.from_name (the [/.#group /.#name] actual_ownership)))
- (n.= (/.from_small /.no_id)
- (/.from_small (the [/.#group /.#id] actual_ownership))))
-
- _
- false)))
- (try.else false)))
- ))))
+ (all _.and
+ (_.cover [/.name_size /.name_is_too_long]
+ (case (/.name invalid)
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.name_is_too_long error)))
+ (_.cover [/.not_ascii]
+ (case (/.name not_ascii)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_ascii error)))
+ (_.cover [/.Name /.name /.from_name]
+ (|> (do try.monad
+ [path (/.path path)
+ content (/.content (binary.empty 0))
+ expected (/.name expected)
+ tar (|> (sequence.sequence {/.#Normal [path
+ (instant.of_millis +0)
+ /.none
+ [/.#user [/.#name expected
+ /.#id /.no_id]
+ /.#group [/.#name /.anonymous
+ /.#id /.no_id]]
+ content]})
+ (format.result /.writer)
+ (<b>.result /.parser))]
+ (in (case (sequence.list tar)
+ (pattern (list {/.#Normal [_ _ _ actual_ownership _]}))
+ (and (text#= (/.from_name expected)
+ (/.from_name (the [/.#user /.#name] actual_ownership)))
+ (text#= (/.from_name /.anonymous)
+ (/.from_name (the [/.#group /.#name] actual_ownership))))
+
+ _
+ false)))
+ (try.else false)))
+ (_.cover [/.anonymous /.no_id]
+ (|> (do try.monad
+ [path (/.path path)
+ content (/.content (binary.empty 0))
+ tar (|> (sequence.sequence {/.#Normal [path
+ (instant.of_millis +0)
+ /.none
+ [/.#user [/.#name /.anonymous
+ /.#id /.no_id]
+ /.#group [/.#name /.anonymous
+ /.#id /.no_id]]
+ content]})
+ (format.result /.writer)
+ (<b>.result /.parser))]
+ (in (case (sequence.list tar)
+ (pattern (list {/.#Normal [_ _ _ actual_ownership _]}))
+ (and (text#= (/.from_name /.anonymous)
+ (/.from_name (the [/.#user /.#name] actual_ownership)))
+ (n.= (/.from_small /.no_id)
+ (/.from_small (the [/.#user /.#id] actual_ownership)))
+ (text#= (/.from_name /.anonymous)
+ (/.from_name (the [/.#group /.#name] actual_ownership)))
+ (n.= (/.from_small /.no_id)
+ (/.from_small (the [/.#group /.#id] actual_ownership))))
+
+ _
+ false)))
+ (try.else false)))
+ ))))
(def: .public test
Test
@@ -397,30 +397,30 @@
(_.for [/.Tar])
(do random.monad
[_ (in [])]
- ($_ _.and
- (_.cover [/.writer /.parser]
- (|> sequence.empty
- (format.result /.writer)
- (<b>.result /.parser)
- (# try.monad each sequence.empty?)
- (try.else false)))
- (_.cover [/.invalid_end_of_archive]
- (let [dump (format.result /.writer sequence.empty)]
- (case (<b>.result /.parser (binary#composite dump dump))
- {try.#Success _}
- false
-
- {try.#Failure error}
- (exception.match? /.invalid_end_of_archive error))))
-
- ..path
- ..name
- ..small
- ..big
- (_.for [/.Entry]
- ($_ _.and
- ..entry
- ..mode
- ..ownership
- ))
- ))))
+ (all _.and
+ (_.cover [/.writer /.parser]
+ (|> sequence.empty
+ (format.result /.writer)
+ (<b>.result /.parser)
+ (# try.monad each sequence.empty?)
+ (try.else false)))
+ (_.cover [/.invalid_end_of_archive]
+ (let [dump (format.result /.writer sequence.empty)]
+ (case (<b>.result /.parser (binary#composite dump dump))
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.invalid_end_of_archive error))))
+
+ ..path
+ ..name
+ ..small
+ ..big
+ (_.for [/.Entry]
+ (all _.and
+ ..entry
+ ..mode
+ ..ownership
+ ))
+ ))))