From: Nuno Lopes Date: Tue, 13 Jun 2006 21:55:38 +0000 (+0000) Subject: add new tests, increasing coverage by about 10% X-Git-Tag: php-5.2.0RC1~318 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c93dc5d873981377b99c33019bda5b2319604e5e;p=php add new tests, increasing coverage by about 10% --- diff --git a/ext/pcre/tests/backtrack_limit.phpt b/ext/pcre/tests/backtrack_limit.phpt new file mode 100644 index 0000000000..ebfd720c3c --- /dev/null +++ b/ext/pcre/tests/backtrack_limit.phpt @@ -0,0 +1,19 @@ +--TEST-- +Backtracking limit +--INI-- +pcre.backtrack_limit=2 +--FILE-- + +--EXPECT-- +int(0) +bool(true) +int(10) +bool(true) diff --git a/ext/pcre/tests/cache_limit.phpt b/ext/pcre/tests/cache_limit.phpt new file mode 100644 index 0000000000..bfe7f1b9a9 --- /dev/null +++ b/ext/pcre/tests/cache_limit.phpt @@ -0,0 +1,25 @@ +--TEST-- +Compiled regex cache limit +--FILE-- + +--EXPECT-- +int(1) +int(1) +done diff --git a/ext/pcre/tests/delimiters.phpt b/ext/pcre/tests/delimiters.phpt new file mode 100644 index 0000000000..0cc235ecaa --- /dev/null +++ b/ext/pcre/tests/delimiters.phpt @@ -0,0 +1,33 @@ +--TEST-- +Delimiters crash test +--FILE-- +', '')); +var_dump(preg_match('~a', '')); +var_dump(preg_match('@\@\@@', '@@')); +var_dump(preg_match('//z', '@@')); + +?> +--EXPECTF-- +Warning: preg_match(): Empty regular expression in %sdelimiters.php on line 3 +bool(false) + +Warning: preg_match(): Empty regular expression in %sdelimiters.php on line 4 +bool(false) +int(1) + +Warning: preg_match(): Delimiter must not be alphanumeric or backslash in %sdelimiters.php on line 6 +bool(false) +int(1) + +Warning: preg_match(): No ending delimiter '~' found in %sdelimiters.php on line 8 +bool(false) +int(1) + +Warning: preg_match(): Unknown modifier 'z' in %sdelimiters.php on line 10 +bool(false) diff --git a/ext/pcre/tests/grep.phpt b/ext/pcre/tests/grep.phpt new file mode 100644 index 0000000000..d3d9032e49 --- /dev/null +++ b/ext/pcre/tests/grep.phpt @@ -0,0 +1,23 @@ +--TEST-- +preg_grep() +--FILE-- + +--EXPECT-- +array(2) { + [1]=> + string(1) "1" + [2]=> + string(2) "q6" +} +array(2) { + [0]=> + string(1) "a" + [3]=> + string(3) "h20" +} diff --git a/ext/pcre/tests/locales.phpt b/ext/pcre/tests/locales.phpt new file mode 100644 index 0000000000..0f55df0aad --- /dev/null +++ b/ext/pcre/tests/locales.phpt @@ -0,0 +1,24 @@ +--TEST-- +Localized match +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(0) +int(1) +int(0) diff --git a/ext/pcre/tests/multiline.phpt b/ext/pcre/tests/multiline.phpt new file mode 100644 index 0000000000..356800917b --- /dev/null +++ b/ext/pcre/tests/multiline.phpt @@ -0,0 +1,18 @@ +--TEST-- +Multi-line match +--FILE-- + +--EXPECT-- +int(0) +int(0) +int(2) +int(2) +done diff --git a/ext/pcre/tests/recursion_limit.phpt b/ext/pcre/tests/recursion_limit.phpt new file mode 100644 index 0000000000..2a43aa27d6 --- /dev/null +++ b/ext/pcre/tests/recursion_limit.phpt @@ -0,0 +1,19 @@ +--TEST-- +PCRE Recursion limit +--INI-- +pcre.recursion_limit=2 +--FILE-- + +--EXPECT-- +int(0) +bool(true) +int(1) +bool(true) diff --git a/ext/pcre/tests/study.phpt b/ext/pcre/tests/study.phpt new file mode 100644 index 0000000000..696a4c0ef0 --- /dev/null +++ b/ext/pcre/tests/study.phpt @@ -0,0 +1,31 @@ +--TEST-- +Study regex +--FILE-- +..)((?:(?>.)|.|.|.|u))/S', 'aeiou', $dump)); +var_dump($dump[1]); + +// try to trigger usual "match known text" optimization +var_dump(preg_match('/^aeiou$/S', 'aeiou', $dump)); +var_dump($dump[0]); +var_dump(preg_match('/aeiou/S', 'aeiou', $dump)); +var_dump($dump[0]); + +?> +--EXPECT-- +int(1) +string(1) "a" +int(1) +string(1) "a" +int(1) +string(1) "i" +int(1) +string(5) "aeiou" +int(1) +string(5) "aeiou"