From 71d0cd594c0df1274d5401f2c36203a71cff6111 Mon Sep 17 00:00:00 2001 From: andy wharmby Date: Mon, 19 Jan 2009 17:13:18 +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..7d3a695d4e --- /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: substr_replace() expects at least 3 parameters, 0 given in %s on line %d +NULL + +Warning: substr_replace() expects at least 3 parameters, 2 given in %s on line %d +NULL + +-- Testing substr_replace() function with more than expected no. of arguments -- + +Warning: substr_replace() expects at most 4 parameters, 5 given 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=== \ No newline at end of file diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt new file mode 100644 index 0000000000..43b2df1c0a --- /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: unpack() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +-- Testing unpack() function with more than expected no. of arguments -- + +Warning: unpack() expects exactly 2 parameters, 3 given 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.40.0