aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/control/parser/xml.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/control/parser/xml.lux')
-rw-r--r--stdlib/source/test/lux/control/parser/xml.lux75
1 files changed, 38 insertions, 37 deletions
diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux
index 81c4da80d..d4cb4c50c 100644
--- a/stdlib/source/test/lux/control/parser/xml.lux
+++ b/stdlib/source/test/lux/control/parser/xml.lux
@@ -6,13 +6,13 @@
[abstract
[monad (#+ do)]]
[control
- ["." try]
+ ["." try ("#\." functor)]
["." exception]]
[data
["." text ("#\." equivalence)]
["." name ("#\." equivalence)]
[format
- ["." xml]]
+ ["." xml ("#\." equivalence)]]
[collection
["." dictionary]
["." list]]]
@@ -40,7 +40,7 @@
[expected (random.ascii/alpha 1)]
(_.cover [<exception>]
(`` (and (~~ (template [<parser> <input>]
- [(|> (/.run <parser> (list <input>))
+ [(|> (/.result <parser> (list <input>))
(!expect (^multi (#try.Failure error)
(exception.match? <exception> error))))]
@@ -61,32 +61,33 @@
($_ _.and
(do {! random.monad}
[expected (random.ascii/alpha 1)]
- (_.cover [/.run /.text]
- (|> (/.run /.text (list (#xml.Text expected)))
+ (_.cover [/.result /.text]
+ (|> (/.result /.text (list (#xml.Text expected)))
(!expect (^multi (#try.Success actual)
(text\= expected actual))))))
(!failure /.unconsumed_inputs
[[(//\in expected)
(#xml.Text expected)]])
(do {! random.monad}
- [expected (random.ascii/alpha 1)]
- (_.cover [/.ignore]
- (|> (/.run /.ignore (list (#xml.Text expected)))
- (!expect (#try.Success [])))))
+ [expected (\ ! map (|>> #xml.Text) (random.ascii/alpha 1))]
+ (_.cover [/.any]
+ (|> (/.result /.any (list expected))
+ (try\map (xml\= expected))
+ (try.else false))))
(do {! random.monad}
[expected ..random_tag]
(_.cover [/.tag]
- (|> (/.run (do //.monad
- [actual /.tag
- _ /.ignore]
- (in (name\= expected actual)))
- (list (#xml.Node expected (dictionary.empty name.hash) (list))))
+ (|> (/.result (do //.monad
+ [actual /.tag
+ _ /.any]
+ (in (name\= expected actual)))
+ (list (#xml.Node expected (dictionary.empty name.hash) (list))))
(!expect (#try.Success #1)))))
(do {! random.monad}
[expected ..random_tag]
(_.cover [/.node]
- (|> (/.run (/.node expected (//\in []))
- (list (#xml.Node expected (dictionary.empty name.hash) (list))))
+ (|> (/.result (/.node expected (//\in []))
+ (list (#xml.Node expected (dictionary.empty name.hash) (list))))
(!expect (#try.Success [])))))
(!failure /.wrong_tag
[[(/.node ["" expected] (//\in []))
@@ -96,13 +97,13 @@
expected_attribute ..random_attribute
expected_value (random.ascii/alpha 1)]
(_.cover [/.attribute]
- (|> (/.run (<| (/.node expected_tag)
- (//.after (/.attribute expected_attribute))
- (//\in []))
- (list (#xml.Node expected_tag
- (|> (dictionary.empty name.hash)
- (dictionary.put expected_attribute expected_value))
- (list))))
+ (|> (/.result (<| (/.node expected_tag)
+ (//.after (/.attribute expected_attribute))
+ (//\in []))
+ (list (#xml.Node expected_tag
+ (|> (dictionary.empty name.hash)
+ (dictionary.put expected_attribute expected_value))
+ (list))))
(!expect (#try.Success [])))))
(!failure /.unknown_attribute
[[(/.attribute ["" expected])
@@ -112,22 +113,22 @@
(list))]])
(!failure /.empty_input
[[(do //.monad
- [_ /.ignore]
- /.ignore)
+ [_ /.any]
+ /.any)
(#xml.Text expected)]
[(do //.monad
- [_ /.ignore]
+ [_ /.any]
/.text)
(#xml.Text expected)]
[(do //.monad
- [_ /.ignore]
+ [_ /.any]
(/.node [expected expected]
(//\in [])))
(#xml.Node [expected expected]
(dictionary.empty name.hash)
(list))]
[(do //.monad
- [_ /.ignore]
+ [_ /.any]
(/.node [expected expected]
(/.attribute [expected expected])))
(#xml.Node [expected expected]
@@ -156,21 +157,21 @@
[_ (<| /.somewhere
(/.node right)
(//\in []))
- _ (//.some /.ignore)]
+ _ (//.some /.any)]
(in [])))]
repetitions (\ ! map (n.% 10) random.nat)]
($_ _.and
(_.cover [/.somewhere]
- (|> (/.run parser
- (list (node parent
- (list.concat (list (list.repeated repetitions (node wrong (list)))
- (list (node right (list)))
- (list.repeated repetitions (node wrong (list))))))))
+ (|> (/.result parser
+ (list (node parent
+ (list.concat (list (list.repeated repetitions (node wrong (list)))
+ (list (node right (list)))
+ (list.repeated repetitions (node wrong (list))))))))
(!expect (#try.Success []))))
(_.cover [/.nowhere]
- (|> (/.run parser
- (list (node parent
- (list.repeated repetitions (node wrong (list))))))
+ (|> (/.result parser
+ (list (node parent
+ (list.repeated repetitions (node wrong (list))))))
(!expect (^multi (#try.Failure error)
(exception.match? /.nowhere error)))))
))