--- code/trunk/pcre_scanner_unittest.cc 2007/02/24 21:41:21 87 +++ code/trunk/pcre_scanner_unittest.cc 2007/02/24 21:41:42 93 @@ -33,10 +33,13 @@ // functionality. #include +#include #include #include #include +#define FLAGS_unittest_stack_size 49152 + // Dies with a fatal error if the two values are not equal. #define CHECK_EQ(a, b) do { \ if ( (a) != (b) ) { \ @@ -116,8 +119,31 @@ comments.resize(0); } +static void TestBigComment() { + string input; + for (int i = 0; i < 1024; ++i) { + char buf[1024]; + snprintf(buf, sizeof(buf), " # Comment %d\n", i); + input += buf; + } + input += "name = value;\n"; + + Scanner s(input.c_str()); + s.SetSkipExpression("\\s+|#.*\n"); + + string name; + string value; + s.Consume("(\\w+) = (\\w+);", &name, &value); + CHECK_EQ(name, "name"); + CHECK_EQ(value, "value"); +} + +// TODO: also test scanner and big-comment in a thread with a +// small stack size + int main(int argc, char** argv) { TestScanner(); + TestBigComment(); // Done printf("OK\n");