From a55dc942cd46274a2342970a7695485b0fe294da Mon Sep 17 00:00:00 2001 From: andy wharmby Date: Mon, 19 Jan 2009 17:13:16 +0000 Subject: [PATCH] New substr_replace() and unpack() error tests. Tested on Windows, Linux and Linux 64 bit. --- .../tests/strings/substr_replace_error.phpt | 70 +++++++++++++++++++ ext/standard/tests/strings/unpack_error.phpt | 42 +++++++++++ 2 files changed, 112 insertions(+) create mode 100644 ext/standard/tests/strings/substr_replace_error.phpt create mode 100644 ext/standard/tests/strings/unpack_error.phpt diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt new file mode 100644 index 0000000000..facea3468b --- /dev/null +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test substr_replace() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing substr_replace() : error conditions *** + +-- Testing substr_replace() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for substr_replace() in %s on line %d +NULL + +Warning: Wrong parameter count for substr_replace() in %s on line %d +NULL + +-- Testing substr_replace() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for substr_replace() in %s on line %d +NULL + +-- Testing substr_replace() function with start and length different types -- + +Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d +string(12) "Good morning" + +Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d +string(12) "Good morning" + +-- Testing substr_replace() function with start and length with a different number of elments -- + +Warning: substr_replace(): 'from' and 'len' should have the same number of elements in %s on line %d +string(12) "Good morning" + +-- Testing substr_replace() function with start and length as arrays but string not-- + +Warning: substr_replace(): Functionality of 'from' and 'len' as arrays is not implemented in %s on line %d +string(12) "Good morning" +===DONE=== diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt new file mode 100644 index 0000000000..32dd25dcb8 --- /dev/null +++ b/ext/standard/tests/strings/unpack_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test unpack() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing unpack() : error conditions *** + +-- Testing unpack() function with no arguments -- + +Warning: Wrong parameter count for unpack() in %s on line %d +NULL + +-- Testing unpack() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for unpack() in %s on line %d +NULL + +-- Testing unpack() function with invalid format character -- + +Warning: unpack(): Invalid format type Z in %s on line %d +bool(false) +===DONE=== -- 2.50.1