Commit 7fb91131 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2369] Check as much as possible that line numbers are decremented correctly

parent 8aa5e22a
......@@ -144,6 +144,29 @@ TEST_F(InputSourceTest, lines) {
// Now we are back to where we started.
EXPECT_EQ(1, source_.getCurrentLine());
EXPECT_FALSE(source_.atEOF());
// Now check that line numbers are decremented properly (as much as
// possible using the available API).
while (!source_.atEOF()) {
source_.getChar();
}
line = source_.getCurrentLine();
// Now, we are at EOF.
EXPECT_TRUE(source_.atEOF());
EXPECT_EQ(4, line);
EXPECT_THROW({
while (true) {
source_.ungetChar();
EXPECT_TRUE(((line == source_.getCurrentLine()) ||
((line - 1) == source_.getCurrentLine())));
line = source_.getCurrentLine();
}
}, isc::OutOfRange);
// Now we are back to where we started.
EXPECT_EQ(1, source_.getCurrentLine());
}
} // end namespace
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment