aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data/format/tar.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/data/format/tar.lux')
-rw-r--r--stdlib/source/test/lux/data/format/tar.lux452
1 files changed, 226 insertions, 226 deletions
diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux
index a62ce9de4..b4c57411f 100644
--- a/stdlib/source/test/lux/data/format/tar.lux
+++ b/stdlib/source/test/lux/data/format/tar.lux
@@ -45,30 +45,30 @@
not_ascii (random.text (random.char (unicode.set [unicode/block.katakana (list)]))
/.path_size)]
(`` (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)))
+ (_.coverage [/.path /.from_path]
+ (case (/.path expected)
+ {try.#Success actual}
+ (text#= expected
+ (/.from_path actual))
+
+ {try.#Failure error}
+ false))
+ (_.coverage [/.no_path]
+ (text#= "" (/.from_path /.no_path)))
+ (_.coverage [/.path_size /.path_is_too_long]
+ (case (/.path invalid)
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.path_is_too_long error)))
+ (_.coverage [/.not_ascii]
+ (case (/.path not_ascii)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_ascii error)))
)))))
(def: name
@@ -80,28 +80,28 @@
not_ascii (random.text (random.char (unicode.set [unicode/block.katakana (list)]))
/.name_size)]
(`` (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)))
+ (_.coverage [/.name /.from_name]
+ (case (/.name expected)
+ {try.#Success actual}
+ (text#= expected
+ (/.from_name actual))
+
+ {try.#Failure error}
+ false))
+ (_.coverage [/.name_size /.name_is_too_long]
+ (case (/.name invalid)
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.name_is_too_long error)))
+ (_.coverage [/.not_ascii]
+ (case (/.name not_ascii)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_ascii error)))
)))))
(def: small
@@ -111,21 +111,21 @@
[expected (|> random.nat (# ! each (n.% /.small_limit)))
invalid (|> random.nat (# ! each (n.max /.small_limit)))]
(`` (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)))
+ (_.coverage [/.small /.from_small]
+ (case (/.small expected)
+ {try.#Success actual}
+ (n.= expected
+ (/.from_small actual))
+
+ {try.#Failure error}
+ false))
+ (_.coverage [/.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
@@ -135,21 +135,21 @@
[expected (|> random.nat (# ! each (n.% /.big_limit)))
invalid (|> random.nat (# ! each (n.max /.big_limit)))]
(`` (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)))
+ (_.coverage [/.big /.from_big]
+ (case (/.big expected)
+ {try.#Success actual}
+ (n.= expected
+ (/.from_big actual))
+
+ {try.#Failure error}
+ false))
+ (_.coverage [/.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)
@@ -168,20 +168,20 @@
(# utf8.codec encoded))]]
(`` (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)))]
+ [(_.coverage [<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]
@@ -189,34 +189,34 @@
(_.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)))]
+ [(_.coverage [<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]
@@ -247,13 +247,36 @@
modes (random.list 4 ..random_mode)
.let [expected_mode (list#mix /.and /.none modes)]]
(`` (all _.and
- (_.cover [/.and]
+ (_.coverage [/.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>]
+ [(_.coverage [<expected_mode>]
(|> (do try.monad
[path (/.path path)
content (/.content (binary.empty 0))
tar (|> (sequence.sequence {/.#Normal [path
(instant.of_millis +0)
- expected_mode
+ <expected_mode>
[/.#user [/.#name /.anonymous
/.#id /.no_id]
/.#group [/.#name /.anonymous
@@ -263,35 +286,12 @@
(<b>.result /.parser))]
(in (case (sequence.list tar)
(pattern (list {/.#Normal [_ _ actual_mode _ _]}))
- (n.= (/.mode expected_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)))]
+ (try.else false)))]
[/.none]
@@ -322,73 +322,73 @@
/.name_size)]
(_.for [/.Ownership /.Owner /.ID]
(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)))
+ (_.coverage [/.name_size /.name_is_too_long]
+ (case (/.name invalid)
+ {try.#Success _}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.name_is_too_long error)))
+ (_.coverage [/.not_ascii]
+ (case (/.name not_ascii)
+ {try.#Success actual}
+ false
+
+ {try.#Failure error}
+ (exception.match? /.not_ascii error)))
+ (_.coverage [/.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)))
+ (_.coverage [/.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
@@ -398,20 +398,20 @@
(do random.monad
[_ (in [])]
(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))))
+ (_.coverage [/.writer /.parser]
+ (|> sequence.empty
+ (format.result /.writer)
+ (<b>.result /.parser)
+ (# try.monad each sequence.empty?)
+ (try.else false)))
+ (_.coverage [/.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