diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/control/parser/xml.lux | 78 |
1 files changed, 22 insertions, 56 deletions
diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index 116f948da..435e3f4d3 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -84,51 +84,31 @@ (do {! random.monad} [expected ..random_tag] (_.cover [/.node] - (|> (/.run (do //.monad - [_ (/.node expected)] - /.ignore) + (|> (/.run (/.node expected (//\wrap [])) (list (#xml.Node expected (dictionary.new name.hash) (list)))) (!expect (#try.Success []))))) (!failure /.wrong_tag - [[(/.node ["" expected]) + [[(/.node ["" expected] (//\wrap [])) (#xml.Node [expected ""] (dictionary.new name.hash) (list))]]) (do {! random.monad} [expected_tag ..random_tag expected_attribute ..random_attribute expected_value (random.ascii/alpha 1)] (_.cover [/.attribute] - (|> (/.run (do //.monad - [_ (/.node expected_tag) - _ (/.attribute expected_attribute)] - /.ignore) + (|> (/.run (<| (/.node expected_tag) + (//.after (/.attribute expected_attribute)) + (//\wrap [])) (list (#xml.Node expected_tag (|> (dictionary.new name.hash) (dictionary.put expected_attribute expected_value)) (list)))) (!expect (#try.Success []))))) (!failure /.unknown_attribute - [[(do //.monad - [_ (/.attribute ["" expected])] - /.ignore) + [[(/.attribute ["" expected]) (#xml.Node [expected expected] (|> (dictionary.new name.hash) (dictionary.put [expected ""] expected)) (list))]]) - (do {! random.monad} - [expected ..random_tag] - (_.cover [/.children] - (|> (/.run (do {! //.monad} - [_ (/.node expected)] - (/.children - (do ! - [_ (/.node expected)] - /.ignore))) - (list (#xml.Node expected - (dictionary.new name.hash) - (list (#xml.Node expected - (dictionary.new name.hash) - (list)))))) - (!expect (#try.Success []))))) (!failure /.empty_input [[(do //.monad [_ /.ignore] @@ -140,43 +120,27 @@ (#xml.Text expected)] [(do //.monad [_ /.ignore] - (/.node [expected expected])) + (/.node [expected expected] + (//\wrap []))) (#xml.Node [expected expected] (dictionary.new name.hash) (list))] [(do //.monad [_ /.ignore] - (/.node [expected expected])) + (/.node [expected expected] + (/.attribute [expected expected]))) (#xml.Node [expected expected] (|> (dictionary.new name.hash) (dictionary.put [expected expected] expected)) - (list))] - [(do //.monad - [_ /.ignore] - (/.children - (/.node [expected expected]))) - (#xml.Node [expected expected] - (dictionary.new name.hash) - (list (#xml.Node [expected expected] - (dictionary.new name.hash) - (list))))]]) + (list))]]) (!failure /.unexpected_input [[/.text (#xml.Node [expected expected] (dictionary.new name.hash) (list))] - [(do //.monad - [_ (/.node [expected expected])] - /.ignore) - (#xml.Text expected)] - [(do //.monad - [_ (/.attribute [expected expected])] - /.ignore) + [(/.node [expected expected] + (//\wrap [])) (#xml.Text expected)] - [(do {! //.monad} - [_ (/.node [expected expected])] - (/.children - (do ! - [_ (/.node [expected expected])] - /.ignore))) + [(/.node [expected expected] + (/.attribute [expected expected])) (#xml.Text expected)]]) (do {! random.monad} [#let [node (: (-> xml.Tag (List xml.XML) xml.XML) @@ -186,11 +150,13 @@ right ..random_tag wrong (random.filter (|>> (name\= right) not) ..random_tag) - #let [parser (/.children - (do //.monad - [_ (/.somewhere (/.node right)) - _ (//.some /.ignore)] - (wrap [])))] + #let [parser (<| (/.node parent) + (do //.monad + [_ (<| /.somewhere + (/.node right) + (//\wrap [])) + _ (//.some /.ignore)] + (wrap [])))] repetitions (\ ! map (n.% 10) random.nat)] ($_ _.and (_.cover [/.somewhere] |