diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-25 23:16:54 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-25 23:16:54 +0100 |
commit | 2629c62e415e9c02fe73f61c92d8148b8dad5bf9 (patch) | |
tree | 2585582a39a70610318810578b69ce9368372ef5 /test/plugins/css/CSSParserTest.cpp | |
parent | e86c292967d85b571344b74fb5eeedf5ebf95aa8 (diff) |
Adapted tests to StandaloneEnvironment, using complete pipeline in XmlParserTest
Diffstat (limited to 'test/plugins/css/CSSParserTest.cpp')
-rw-r--r-- | test/plugins/css/CSSParserTest.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/test/plugins/css/CSSParserTest.cpp b/test/plugins/css/CSSParserTest.cpp index 46b4ebb..33b97af 100644 --- a/test/plugins/css/CSSParserTest.cpp +++ b/test/plugins/css/CSSParserTest.cpp @@ -22,10 +22,14 @@ #include <sstream> #include <core/frontend/TerminalLogger.hpp> -#include <core/parser/StandaloneParserContext.hpp> +#include <core/StandaloneEnvironment.hpp> #include <plugins/css/CSSParser.hpp> namespace ousia { + +static TerminalLogger logger(std::cerr, true); +//static ConcreteLogger logger; + TEST(CSSParser, testParseSelectors) { // create a string describing a SelectorTree @@ -39,12 +43,12 @@ TEST(CSSParser, testParseSelectors) */ // initialize an empty parser context. - StandaloneParserContext ctx; + StandaloneEnvironment env(logger); // parse the data. CSSParser instance; Rooted<SelectorNode> root = - instance.parse(data, ctx.context).cast<SelectorNode>(); + instance.parse(data, env.context).cast<SelectorNode>(); // we expect three children of the root node overall. ASSERT_EQ(3U, root->getEdges().size()); @@ -149,13 +153,13 @@ TEST(CSSParser, testParseCSS) input << "}\n"; // initialize an empty parser context. - StandaloneParserContext ctx; + StandaloneEnvironment env(logger); // parse the input. CSSParser instance; CharReader reader{input}; Rooted<SelectorNode> root = - instance.parse(reader, ctx.context).cast<SelectorNode>(); + instance.parse(reader, env.context).cast<SelectorNode>(); // we expect three children of the root node overall. ASSERT_EQ(3U, root->getEdges().size()); @@ -264,12 +268,13 @@ TEST(CSSParser, testParseCSS) void assertException(std::string css) { CharReader reader(css); - TerminalLogger logger(std::cerr, true); { - StandaloneParserContext ctx(logger); + StandaloneEnvironment env(logger); CSSParser instance; + + logger.reset(); try { - instance.parse(reader, ctx.context).cast<SelectorNode>(); + instance.parse(reader, env.context).cast<SelectorNode>(); } catch (LoggableException ex) { logger.log(ex); |