From: Nuno Lopes Date: Wed, 14 Jun 2006 17:37:53 +0000 (+0000) Subject: more tests (and fix 2 from yesterday) X-Git-Tag: php-5.2.0RC1~312 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7bc286638ff4ed9ac8ced1969dc945caf815024;p=php more tests (and fix 2 from yesterday) --- diff --git a/ext/pcre/tests/delimiters.phpt b/ext/pcre/tests/delimiters.phpt index 0cc235ecaa..1826f8730a 100644 --- a/ext/pcre/tests/delimiters.phpt +++ b/ext/pcre/tests/delimiters.phpt @@ -11,6 +11,7 @@ var_dump(preg_match('<>', '')); var_dump(preg_match('~a', '')); var_dump(preg_match('@\@\@@', '@@')); var_dump(preg_match('//z', '@@')); +var_dump(preg_match('{', '')); ?> --EXPECTF-- @@ -31,3 +32,6 @@ int(1) Warning: preg_match(): Unknown modifier 'z' in %sdelimiters.php on line 10 bool(false) + +Warning: preg_match(): No ending matching delimiter '}' found in %sdelimiters.php on line 11 +bool(false) diff --git a/ext/pcre/tests/dollar_endonly.phpt b/ext/pcre/tests/dollar_endonly.phpt new file mode 100644 index 0000000000..96a52441df --- /dev/null +++ b/ext/pcre/tests/dollar_endonly.phpt @@ -0,0 +1,39 @@ +--TEST-- +D (PCRE_DOLLAR_ENDONLY) modififer +--FILE-- + +--EXPECT-- +int(1) +array(1) { + [0]=> + array(1) { + [0]=> + string(5) "aeiou" + } +} +int(0) +array(1) { + [0]=> + array(0) { + } +} +int(1) +array(1) { + [0]=> + array(1) { + [0]=> + string(6) "aeiou +" + } +} diff --git a/ext/pcre/tests/locales.phpt b/ext/pcre/tests/locales.phpt index 0f55df0aad..2e90c3d32a 100644 --- a/ext/pcre/tests/locales.phpt +++ b/ext/pcre/tests/locales.phpt @@ -1,7 +1,7 @@ --TEST-- Localized match --SKIPIF-- - + --FILE-- +--EXPECT-- +int(2) +array(2) { + [0]=> + array(2) { + [0]=> + string(2) "zx" + [1]=> + string(2) "ax" + } + [1]=> + array(2) { + [0]=> + string(1) "z" + [1]=> + string(1) "a" + } +} +int(2) +array(2) { + [0]=> + array(2) { + [0]=> + string(2) "zx" + [1]=> + string(1) "z" + } + [1]=> + array(2) { + [0]=> + string(2) "yx" + [1]=> + string(1) "y" + } +} +int(2) +array(2) { + [0]=> + array(2) { + [0]=> + array(2) { + [0]=> + string(2) "zx" + [1]=> + int(0) + } + [1]=> + array(2) { + [0]=> + string(2) "yx" + [1]=> + int(2) + } + } + [1]=> + array(2) { + [0]=> + array(2) { + [0]=> + string(1) "z" + [1]=> + int(0) + } + [1]=> + array(2) { + [0]=> + string(1) "y" + [1]=> + int(2) + } + } +} +int(2) +array(2) { + [0]=> + array(2) { + [0]=> + array(2) { + [0]=> + string(2) "zx" + [1]=> + int(0) + } + [1]=> + array(2) { + [0]=> + string(1) "z" + [1]=> + int(0) + } + } + [1]=> + array(2) { + [0]=> + array(2) { + [0]=> + string(2) "yx" + [1]=> + int(2) + } + [1]=> + array(2) { + [0]=> + string(1) "y" + [1]=> + int(2) + } + } +} diff --git a/ext/pcre/tests/match_flags2.phpt b/ext/pcre/tests/match_flags2.phpt new file mode 100644 index 0000000000..f703091735 --- /dev/null +++ b/ext/pcre/tests/match_flags2.phpt @@ -0,0 +1,95 @@ +--TEST-- +preg_match() flags +--FILE-- +.)(x)(?P\S+)/', 'fjszxax', $match, PREG_OFFSET_CAPTURE)); +var_dump($match); + +?> +--EXPECT-- +int(1) +array(2) { + [0]=> + array(2) { + [0]=> + string(2) "xa" + [1]=> + int(4) + } + [1]=> + array(2) { + [0]=> + string(1) "a" + [1]=> + int(5) + } +} +int(1) +array(2) { + [0]=> + array(2) { + [0]=> + string(2) "ax" + [1]=> + int(5) + } + [1]=> + array(2) { + [0]=> + string(1) "a" + [1]=> + int(5) + } +} +int(1) +array(6) { + [0]=> + array(2) { + [0]=> + string(4) "zxax" + [1]=> + int(3) + } + ["capt1"]=> + array(2) { + [0]=> + string(1) "z" + [1]=> + int(3) + } + [1]=> + array(2) { + [0]=> + string(1) "z" + [1]=> + int(3) + } + [2]=> + array(2) { + [0]=> + string(1) "x" + [1]=> + int(4) + } + ["letsmix"]=> + array(2) { + [0]=> + string(2) "ax" + [1]=> + int(5) + } + [3]=> + array(2) { + [0]=> + string(2) "ax" + [1]=> + int(5) + } +} diff --git a/ext/pcre/tests/pcre_anchored.phpt b/ext/pcre/tests/pcre_anchored.phpt new file mode 100644 index 0000000000..caa96437e1 --- /dev/null +++ b/ext/pcre/tests/pcre_anchored.phpt @@ -0,0 +1,22 @@ +--TEST-- +A (PCRE_ANCHORED) modififer +--FILE-- + +--EXPECT-- +int(1) +array(1) { + [0]=> + string(3) "abc" +} +int(0) +int(0) +int(0) diff --git a/ext/pcre/tests/pcre_extended.phpt b/ext/pcre/tests/pcre_extended.phpt new file mode 100644 index 0000000000..6c4b20e7f0 --- /dev/null +++ b/ext/pcre/tests/pcre_extended.phpt @@ -0,0 +1,29 @@ +--TEST-- +x (PCRE_EXTENDED) modififer +--FILE-- + +--EXPECT-- +int(0) +array(0) { +} +int(1) +array(1) { + [0]=> + string(5) "aeiou" +} +int(1) +array(1) { + [0]=> + string(5) "aeiou" +} diff --git a/ext/pcre/tests/pcre_extra.phpt b/ext/pcre/tests/pcre_extra.phpt new file mode 100644 index 0000000000..2bee408fbf --- /dev/null +++ b/ext/pcre/tests/pcre_extra.phpt @@ -0,0 +1,14 @@ +--TEST-- +X (PCRE_EXTRA) modififer +--FILE-- + +--EXPECTF-- +int(1) + +Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in %spcre_extra.php on line 4 +bool(false) diff --git a/ext/pcre/tests/ungreedy.phpt b/ext/pcre/tests/ungreedy.phpt new file mode 100644 index 0000000000..cf5e8adafd --- /dev/null +++ b/ext/pcre/tests/ungreedy.phpt @@ -0,0 +1,31 @@ +--TEST-- +U (PCRE_UNGREEDY) modififer +--FILE-- +/', ' ', $m)); +var_dump($m); + +var_dump(preg_match('/<.*>/U', ' ', $m)); +var_dump($m); + +var_dump(preg_match('/(?U)<.*>/', ' ', $m)); +var_dump($m); + +?> +--EXPECT-- +int(1) +array(1) { + [0]=> + string(14) " " +} +int(1) +array(1) { + [0]=> + string(4) "" +} +int(1) +array(1) { + [0]=> + string(4) "" +}