From: andy wharmby Date: Wed, 7 Jan 2009 14:52:26 +0000 (+0000) Subject: New pcre extension tests. Tested on Windows, Linux and Linux 64-bit X-Git-Tag: php-5.3.0beta1~251 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f56f22fa3614975359eb9820bbc93ee01953dd9;p=php New pcre extension tests. Tested on Windows, Linux and Linux 64-bit --- diff --git a/ext/pcre/tests/pcre.constants.phpt b/ext/pcre/tests/pcre.constants.phpt new file mode 100644 index 0000000000..0b103308e1 --- /dev/null +++ b/ext/pcre/tests/pcre.constants.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test for pre-defined pcre constants +--FILE-- + +===Done=== +--EXPECT-- +PCRE constants test +PREG_PATTERN_ORDER= 1 +PREG_OFFSET_CAPTURE= 256 +PREG_SPLIT_NO_EMPTY= 1 +PREG_SPLIT_DELIM_CAPTURE= 2 +PREG_SPLIT_OFFSET_CAPTURE= 4 +PREG_GREP_INVERT= 1 +PREG_NO_ERROR= 0 +PREG_INTERNAL_ERROR= 1 +PREG_BACKTRACK_LIMIT_ERROR= 2 +PREG_RECURSION_LIMIT_ERROR= 3 +PREG_BAD_UTF8_ERROR= 4 +===Done=== \ No newline at end of file diff --git a/ext/pcre/tests/preg_last_error_error.phpt b/ext/pcre/tests/preg_last_error_error.phpt new file mode 100644 index 0000000000..c75e2f86c1 --- /dev/null +++ b/ext/pcre/tests/preg_last_error_error.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test preg_grep() function : error conditions - wrong numbers of parameters +--FILE-- + +===Done=== +--EXPECTF-- +*** Testing preg_last_error() : error conditions *** + +-- Testing preg_last_error() function with more than expected no. of arguments -- + +Warning: preg_last_error() expects exactly 0 parameters, 1 given in %s on line %d +NULL +===Done=== \ No newline at end of file diff --git a/ext/pcre/tests/preg_match_basic_002.phpt b/ext/pcre/tests/preg_match_basic_002.phpt new file mode 100644 index 0000000000..977a67ea10 --- /dev/null +++ b/ext/pcre/tests/preg_match_basic_002.phpt @@ -0,0 +1,23 @@ +--TEST-- +preg_match() single line match with multi-line input +--FILE-- + +===Done=== +--EXPECTF-- +array(2) { + [0]=> + string(2) "My" + [1]=> + string(1) "y" +} +===Done=== \ No newline at end of file diff --git a/ext/pcre/tests/preg_match_variation1.phpt b/ext/pcre/tests/preg_match_variation1.phpt new file mode 100644 index 0000000000..a289ee48ee --- /dev/null +++ b/ext/pcre/tests/preg_match_variation1.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test preg_match() function : variation +--FILE-- + +===Done=== +--EXPECT-- +array(1) { + [0]=> + string(2) "-1" +} +===Done=== diff --git a/ext/pcre/tests/preg_replace_callback_error1.phpt b/ext/pcre/tests/preg_replace_callback_error1.phpt new file mode 100644 index 0000000000..a00b97c1bb --- /dev/null +++ b/ext/pcre/tests/preg_replace_callback_error1.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test preg_replace_callback() function : error +--FILE-- + +===Done=== +--EXPECTF-- +*** Testing preg_replace_callback() : error conditions *** + +Arg value is abcdef + +Warning: preg_replace_callback(): Delimiter must not be alphanumeric or backslash in %s on line %d +NULL + +Arg value is /[a-zA-Z] + +Warning: preg_replace_callback(): No ending delimiter '/' found in %s on line %d +NULL + +Arg value is [a-zA-Z]/ + +Warning: preg_replace_callback(): Unknown modifier '/' in %s on line %d +NULL + +Arg value is /[a-zA-Z]/F + +Warning: preg_replace_callback(): Unknown modifier 'F' in %s on line %d +NULL + +Arg value is Array +string(9) "number 1." + +Arg value is /[a-zA-Z]/ +string(3) " 1." +===Done=== \ No newline at end of file