summaryrefslogtreecommitdiff
path: root/ext/pcre/pcrelib/pcre_scanner_unittest.cc
diff options
context:
space:
mode:
authorNuno Lopes <nlopess@php.net>2007-02-09 20:13:18 +0000
committerNuno Lopes <nlopess@php.net>2007-02-09 20:13:18 +0000
commit66837ba30b7e640b6ab1711ea5c019b7b73c4e1c (patch)
tree496f445f90350c89bafc78f47b478615a4724166 /ext/pcre/pcrelib/pcre_scanner_unittest.cc
parent32a4dee8a09d1b32fab0c9f283ea1695c62e7489 (diff)
downloadphp-git-66837ba30b7e640b6ab1711ea5c019b7b73c4e1c.tar.gz
upgrade PCRE to version 7.0
Diffstat (limited to 'ext/pcre/pcrelib/pcre_scanner_unittest.cc')
-rw-r--r--ext/pcre/pcrelib/pcre_scanner_unittest.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/pcre/pcrelib/pcre_scanner_unittest.cc b/ext/pcre/pcrelib/pcre_scanner_unittest.cc
index 756823cbb1..d939fedeca 100644
--- a/ext/pcre/pcrelib/pcre_scanner_unittest.cc
+++ b/ext/pcre/pcrelib/pcre_scanner_unittest.cc
@@ -33,10 +33,13 @@
// functionality.
#include <stdio.h>
+#include <string>
#include <vector>
#include <pcre_stringpiece.h>
#include <pcre_scanner.h>
+#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 @@ static void TestScanner() {
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");