Commit fdd380bb authored by miloyip's avatar miloyip

Added insitu parsing test for kParseStopWhenDoneFlag

Related to discussion in #83
parent e6f34463
......@@ -578,6 +578,29 @@ TEST(Reader, ParseIterative_MultipleRoot) {
TestMultipleRoot<kParseIterativeFlag | kParseStopWhenDoneFlag>();
}
template <unsigned parseFlags>
void TestInsituMultipleRoot() {
char* buffer = strdup("{}[] a");
InsituStringStream s(buffer);
ParseMultipleRootHandler h;
Reader reader;
EXPECT_TRUE(reader.Parse<kParseInsituFlag | parseFlags>(s, h));
EXPECT_EQ(2u, h.step_);
EXPECT_TRUE(reader.Parse<kParseInsituFlag | parseFlags>(s, h));
EXPECT_EQ(4u, h.step_);
EXPECT_EQ(' ', s.Take());
EXPECT_EQ('a', s.Take());
free(buffer);
}
TEST(Reader, ParseInsitu_MultipleRoot) {
TestInsituMultipleRoot<kParseStopWhenDoneFlag>();
}
TEST(Reader, ParseInsituIterative_MultipleRoot) {
TestInsituMultipleRoot<kParseIterativeFlag | kParseStopWhenDoneFlag>();
}
#define TEST_ERROR(errorCode, str) \
{ \
char buffer[1001]; \
......
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