Testing Parser’s reset method.

This commit is contained in:
Patrick Lühne 2016-06-22 09:02:46 +01:00
parent 234938349c
commit b5e325cbee

View File

@ -91,6 +91,8 @@ TEST(UtilsTests, ParserPosition)
std::stringstream s("123 \n4\ntest1\n test2\ntest3 \ntest4\n\n\n\n"); std::stringstream s("123 \n4\ntest1\n test2\ntest3 \ntest4\n\n\n\n");
plasp::utils::Parser p("input", s); plasp::utils::Parser p("input", s);
const auto startPosition = p.position();
plasp::utils::Parser::Coordinate c; plasp::utils::Parser::Coordinate c;
c = p.coordinate(); c = p.coordinate();
@ -172,6 +174,10 @@ TEST(UtilsTests, ParserPosition)
ASSERT_EQ(c.column, 1u); ASSERT_EQ(c.column, 1u);
ASSERT_TRUE(p.atEndOfStream()); ASSERT_TRUE(p.atEndOfStream());
p.reset();
ASSERT_EQ(p.position(), startPosition);
ASSERT_FALSE(p.atEndOfStream());
// TODO: test parser with multiple sections // TODO: test parser with multiple sections
} }