aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/control/parser/cli.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-06-27 03:26:33 -0400
committerEduardo Julian2022-06-27 03:26:33 -0400
commit149515fd173947dcff20558fca077fbd16dc9b6c (patch)
tree3271f60268a35a132391b857b9f7985f75cbfcd8 /stdlib/source/test/lux/control/parser/cli.lux
parent3265f6a71723c100559eaea188d3762ceedce3b9 (diff)
New "parser" hierarchy. [Part 5]
Diffstat (limited to 'stdlib/source/test/lux/control/parser/cli.lux')
-rw-r--r--stdlib/source/test/lux/control/parser/cli.lux86
1 files changed, 0 insertions, 86 deletions
diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux
deleted file mode 100644
index 46f04712c..000000000
--- a/stdlib/source/test/lux/control/parser/cli.lux
+++ /dev/null
@@ -1,86 +0,0 @@
-(.require
- [library
- [lux (.except)
- ["_" test (.only Test)]
- [abstract
- [monad (.only do)]]
- [control
- ["[0]" try]
- ["<>" parser]]
- [data
- ["[0]" text (.use "[1]#[0]" equivalence)]
- [collection
- ["[0]" list]]]
- [macro
- ["^" pattern]]
- [math
- ["[0]" random]
- [number
- ["n" nat (.use "[1]#[0]" decimal)]]]]]
- [\\library
- ["[0]" /]])
-
-(def !expect
- (template (_ <pattern> <value>)
- [(case <value>
- <pattern>
- true
-
- _
- false)]))
-
-(def .public test
- Test
- (<| (_.covering /._)
- (_.for [/.Parser])
- (do [! random.monad]
- [expected (at ! each n#encoded random.nat)
- .let [random_dummy (random.only (|>> (text#= expected) not)
- (random.unicode 5))]
- dummy random_dummy
- short (random.unicode 1)
- long (random.unicode 2)
- pre_ignore (random.list 5 random_dummy)
- post_ignore (random.list 5 random_dummy)]
- (all _.and
- (_.coverage [/.result /.any]
- (|> (/.result /.any (list expected))
- (!expect (^.multi {try.#Success actual}
- (text#= expected actual)))))
- (_.coverage [/.parse]
- (|> (/.result (/.parse n#decoded) (list expected))
- (!expect (^.multi {try.#Success actual}
- (text#= expected
- (n#encoded actual))))))
- (_.coverage [/.this]
- (and (|> (/.result (/.this expected) (list expected))
- (!expect {try.#Success _}))
- (|> (/.result (/.this expected) (list dummy))
- (!expect {try.#Failure _}))))
- (_.coverage [/.somewhere]
- (|> (/.result (|> (/.somewhere (/.this expected))
- (<>.before (<>.some /.any)))
- (list.together (list pre_ignore (list expected) post_ignore)))
- (!expect {try.#Success _})))
- (_.coverage [/.end]
- (and (|> (/.result /.end (list))
- (!expect {try.#Success _}))
- (|> (/.result (<>.not /.end) (list expected))
- (!expect {try.#Failure _}))))
- (_.coverage [/.named]
- (|> (/.result (/.named dummy /.any) (list dummy expected))
- (!expect (^.multi {try.#Success actual}
- (text#= expected actual)))))
- (_.coverage [/.parameter]
- (and (|> (/.result (/.parameter [short long] /.any)
- (list short expected))
- (!expect (^.multi {try.#Success actual}
- (text#= expected actual))))
- (|> (/.result (/.parameter [short long] /.any)
- (list long expected))
- (!expect (^.multi {try.#Success actual}
- (text#= expected actual))))
- (|> (/.result (/.parameter [short long] /.any)
- (list dummy expected))
- (!expect {try.#Failure _}))))
- ))))