Commit 8aa5e22a authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2369] Fix test, skipping backwards before doing newline check

parent 29ff6beb
...@@ -55,10 +55,10 @@ InputSource::ungetChar() { ...@@ -55,10 +55,10 @@ InputSource::ungetChar() {
} else if (buffer_pos_ == 0) { } else if (buffer_pos_ == 0) {
isc_throw(OutOfRange, "Cannot skip before the start of buffer"); isc_throw(OutOfRange, "Cannot skip before the start of buffer");
} else { } else {
buffer_pos_--;
if (buffer_[buffer_pos_] == '\n') { if (buffer_[buffer_pos_] == '\n') {
line_--; line_--;
} }
buffer_pos_--;
} }
} }
......
...@@ -132,8 +132,10 @@ TEST_F(InputSourceTest, lines) { ...@@ -132,8 +132,10 @@ TEST_F(InputSourceTest, lines) {
EXPECT_TRUE(source_.atEOF()); EXPECT_TRUE(source_.atEOF());
EXPECT_EQ(4, source_.getCurrentLine()); EXPECT_EQ(4, source_.getCurrentLine());
// Go backwards 1 character, skipping the last '\n'. // Go backwards 2 characters, skipping the last EOF and '\n'.
source_.ungetChar(); source_.ungetChar();
source_.ungetChar();
EXPECT_FALSE(source_.atEOF()); EXPECT_FALSE(source_.atEOF());
EXPECT_EQ(3, source_.getCurrentLine()); EXPECT_EQ(3, source_.getCurrentLine());
......
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