aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data/text/regex.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/data/text/regex.lux')
-rw-r--r--stdlib/source/test/lux/data/text/regex.lux80
1 files changed, 42 insertions, 38 deletions
diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux
index d5596ae56..0ab71cbaa 100644
--- a/stdlib/source/test/lux/data/text/regex.lux
+++ b/stdlib/source/test/lux/data/text/regex.lux
@@ -1,56 +1,59 @@
(.using
- [library
- [lux "*"
- ["_" test {"+" Test}]
- [abstract
- [monad {"+" do}]]
- [control
- pipe
- ["[0]" try]
- [parser
- ["<[0]>" text {"+" Parser}]
- ["<[0]>" code]]]
- [data
- ["[0]" text ("[1]#[0]" equivalence)
- ["%" format {"+" format}]]]
- ["[0]" macro
- [syntax {"+" syntax:}]
- ["[0]" code]]
- [math
- [number {"+" hex}]
- ["[0]" random]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]
+ [abstract
+ [monad {"+" do}]]
+ [control
+ ["[0]" pipe]
+ ["[0]" try]
+ [parser
+ ["<[0]>" text {"+" Parser}]
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text ("[1]#[0]" equivalence)
+ ["%" format {"+" format}]]]
+ ["[0]" macro
+ [syntax {"+" syntax:}]
+ ["[0]" code]]
+ [math
+ [number {"+" hex}]
+ ["[0]" random]]]]
+ [\\library
+ ["[0]" /]])
(def: (should_pass regex input)
(-> (Parser Text) Text Bit)
(|> input
(<text>.result regex)
- (case> {try.#Success parsed}
- (text#= parsed input)
+ (pipe.case
+ {try.#Success parsed}
+ (text#= parsed input)
- _
- #0)))
+ _
+ #0)))
(def: (text_should_pass test regex input)
(-> Text (Parser Text) Text Bit)
(|> input
(<text>.result regex)
- (case> {try.#Success parsed}
- (text#= test parsed)
+ (pipe.case
+ {try.#Success parsed}
+ (text#= test parsed)
- _
- false)))
+ _
+ false)))
(def: (should_fail regex input)
(All (_ a) (-> (Parser a) Text Bit))
(|> input
(<text>.result regex)
- (case> {try.#Failure _}
- true
+ (pipe.case
+ {try.#Failure _}
+ true
- _
- false)))
+ _
+ false)))
(syntax: (should_check [pattern <code>.any
regex <code>.any
@@ -58,11 +61,12 @@
(macro.with_symbols [g!message g!_]
(in (list (` (|> (~ input)
(<text>.result (~ regex))
- (case> (^ {try.#Success (~ pattern)})
- true
+ (pipe.case
+ (^ {try.#Success (~ pattern)})
+ true
- (~ g!_)
- false)))))))
+ (~ g!_)
+ false)))))))
(def: basics
Test