diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-07-24 23:47:18 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-07-24 23:47:18 +0900 |
| commit | 9620bb0a6d399ba04f89f575f98eb53b3b252020 (patch) | |
| tree | 49c8ee5b16c017cff9fa4aa688b7f938056f33a0 /test/ValueBaseJsonParserTest.cc | |
| parent | 2684db766d0d378d1193fa068fac0bc6d80ebe7f (diff) | |
Fix off by 1 error in JsonParser::parseUpdate() return value
Diffstat (limited to 'test/ValueBaseJsonParserTest.cc')
| -rw-r--r-- | test/ValueBaseJsonParserTest.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/ValueBaseJsonParserTest.cc b/test/ValueBaseJsonParserTest.cc index 97443d2b..546206d8 100644 --- a/test/ValueBaseJsonParserTest.cc +++ b/test/ValueBaseJsonParserTest.cc @@ -220,7 +220,15 @@ void ValueBaseJsonParserTest::testParseUpdate() const String* s = downcast<String>(list->get(0)); CPPUNIT_ASSERT_EQUAL(std::string("foo$b¢€baz"), s->s()); } - + { + // ignore garbage at the end of the input. + std::string src = "[]trail"; + SharedHandle<ValueBase> r = parser.parseFinal(src.c_str(), src.size(), + error); + const List* list = downcast<List>(r); + CPPUNIT_ASSERT(list); + CPPUNIT_ASSERT_EQUAL((ssize_t)2, error); + } } namespace { |
