From bf29902c143676ade0db7e74a26111bed1e679ed Mon Sep 17 00:00:00 2001 From: andy wharmby Date: Wed, 7 Jan 2009 14:49:56 +0000 Subject: [PATCH] New pcre extension tests. Tested on Windows, Linux and Linux 64-bit --- ext/pcre/tests/pcre.constants.phpt | 35 +++++++++++ ext/pcre/tests/preg_last_error_error.phpt | 30 ++++++++++ ext/pcre/tests/preg_match_basic_002.phpt | 23 ++++++++ ext/pcre/tests/preg_match_variation1.phpt | 22 +++++++ .../tests/preg_replace_callback_error1.phpt | 59 +++++++++++++++++++ 5 files changed, 169 insertions(+) create mode 100644 ext/pcre/tests/pcre.constants.phpt create mode 100644 ext/pcre/tests/preg_last_error_error.phpt create mode 100644 ext/pcre/tests/preg_match_basic_002.phpt create mode 100644 ext/pcre/tests/preg_match_variation1.phpt create mode 100644 ext/pcre/tests/preg_replace_callback_error1.phpt 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..364964baf0 --- /dev/null +++ b/ext/pcre/tests/preg_replace_callback_error1.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test preg_replace_callback() function : error +--FILE-- + +--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 -- 2.40.0