summaryrefslogtreecommitdiff
path: root/test/plugins
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-27 16:01:53 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-27 16:01:53 +0100
commiteb6ecdcc85ece4eb84b90f3c9bb920dc1ad2b6d1 (patch)
treecaaaaa969471552a13f5315a3de6e9db15b02a8b /test/plugins
parent07d326d02415467ba7f5f238a8e72a9e4b7f1549 (diff)
Parsers do no longer return the node they have parsed (as this may be ill-defined -- if a parser only parses a partial document via include, there may be many to no nodes that are returned). Parsers should just use the ParserScope.push funciton. All nodes pushed onto the top-level of the ParserScope are added treated as the nodes the parser has parsed. Adapted all code and all tests accordingly.
Diffstat (limited to 'test/plugins')
-rw-r--r--test/plugins/css/CSSParserTest.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/test/plugins/css/CSSParserTest.cpp b/test/plugins/css/CSSParserTest.cpp
index 815efa2..2855e81 100644
--- a/test/plugins/css/CSSParserTest.cpp
+++ b/test/plugins/css/CSSParserTest.cpp
@@ -46,8 +46,10 @@ TEST(CSSParser, testParseSelectors)
// parse the data.
CSSParser instance;
- Rooted<model::SelectorNode> root =
- instance.parse(data, env.context).cast<model::SelectorNode>();
+ instance.parse(data, env.context);
+ auto nodes = env.context.getScope().getTopLevelNodes();
+ ASSERT_EQ(1U, nodes.size());
+ Rooted<model::SelectorNode> root = nodes[0].cast<model::SelectorNode>();
// we expect three children of the root node overall.
ASSERT_EQ(3U, root->getEdges().size());
@@ -158,8 +160,10 @@ TEST(CSSParser, testParseCSS)
// parse the input.
CSSParser instance;
CharReader reader{input};
- Rooted<model::SelectorNode> root =
- instance.parse(reader, env.context).cast<model::SelectorNode>();
+ instance.parse(reader, env.context);
+ auto nodes = env.context.getScope().getTopLevelNodes();
+ ASSERT_EQ(1U, nodes.size());
+ Rooted<model::SelectorNode> root = nodes[0].cast<model::SelectorNode>();
// we expect three children of the root node overall.
ASSERT_EQ(3U, root->getEdges().size());
@@ -274,7 +278,8 @@ void assertException(std::string css)
logger.reset();
try {
- instance.parse(reader, env.context).cast<model::SelectorNode>();
+ instance.parse(reader, env.context);
+ ASSERT_EQ(1U, env.context.getScope().getTopLevelNodes().size());
}
catch (LoggableException ex) {
logger.log(ex);