]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2369] Fix test, skipping backwards before doing newline check
authorMukund Sivaraman <muks@isc.org>
Mon, 29 Oct 2012 02:41:06 +0000 (08:11 +0530)
committerMukund Sivaraman <muks@isc.org>
Mon, 29 Oct 2012 02:41:06 +0000 (08:11 +0530)
src/lib/dns/inputsource.cc
src/lib/dns/tests/inputsource_unittest.cc

index a93993b24897ccf3898506ca1f8e8196ae0e9b94..faa7a2f79916343bcf922b758343f9ee59fc65bb 100644 (file)
@@ -55,10 +55,10 @@ InputSource::ungetChar() {
     } else if (buffer_pos_ == 0) {
         isc_throw(OutOfRange, "Cannot skip before the start of buffer");
     } else {
+        buffer_pos_--;
         if (buffer_[buffer_pos_] == '\n') {
             line_--;
         }
-        buffer_pos_--;
     }
 }
 
index 274c16efc8ed138739721b614513ae3e41252a92..6298c21123c88bd4e3c800ae370ef8b905b2b883 100644 (file)
@@ -132,8 +132,10 @@ TEST_F(InputSourceTest, lines) {
     EXPECT_TRUE(source_.atEOF());
     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();
+
     EXPECT_FALSE(source_.atEOF());
     EXPECT_EQ(3, source_.getCurrentLine());