From: andy wharmby Date: Sat, 17 Jan 2009 15:47:59 +0000 (+0000) Subject: New ltrim() tests. Tested on Windows, Linux and Linux 64 bit X-Git-Tag: php-5.3.0beta1~123 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d70ea4bc8a4d2f6b06cfd2ad6783306c02dcc485;p=php New ltrim() tests. Tested on Windows, Linux and Linux 64 bit --- diff --git a/ext/standard/tests/strings/ltrim_basic.phpt b/ext/standard/tests/strings/ltrim_basic.phpt new file mode 100644 index 0000000000..74769cac9f --- /dev/null +++ b/ext/standard/tests/strings/ltrim_basic.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test ltrim() function : basic functionality +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing ltrim() : basic functionality *** + +-- Trim string with all white space characters -- +string(29) "---These are a few words--- " + +-- Trim non-whitespace from a string -- +string(15) "Hello World===!" + +-- Trim some non-white space characters from a string -- +string(10) " World===!" + +-- Trim some non-white space characters from a string suing a character range -- +string(10) "0123456789" + +-- Trim the ASCII control characters at the beginning of a string -- +string(14) "Example string" +===DONE=== diff --git a/ext/standard/tests/strings/ltrim_error.phpt b/ext/standard/tests/strings/ltrim_error.phpt new file mode 100644 index 0000000000..eb4f938152 --- /dev/null +++ b/ext/standard/tests/strings/ltrim_error.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test ltrim() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing ltrim() : error conditions *** + +-- Testing ltrim() function with no arguments -- + +Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing ltrim() function with more than expected no. of arguments -- + +Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d +NULL + +-- Test ltrim function with various invalid charlists + +Warning: ltrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d +string(14) " Hello World +" + +Warning: ltrim(): Invalid '..'-range, no character to the right of '..' in %s on line %d +string(14) " Hello World +" + +Warning: ltrim(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d +string(14) " Hello World +" + +Warning: ltrim(): Invalid '..'-range in %s on line %d +string(14) " Hello World +" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/ltrim_variation1.phpt b/ext/standard/tests/strings/ltrim_variation1.phpt new file mode 100644 index 0000000000..5e88526609 --- /dev/null +++ b/ext/standard/tests/strings/ltrim_variation1.phpt @@ -0,0 +1,138 @@ +--TEST-- +Test ltrim() function : usage variations - test values for $str argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing ltrim() function: with unexpected inputs for 'str' argument *** +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(3) "255" +-- Iteration 4 -- +string(3) "256" +-- Iteration 5 -- +string(10) "2147483647" +-- Iteration 6 -- +string(10) "2147483648" +-- Iteration 7 -- +string(4) "10.5" +-- Iteration 8 -- +string(4) "20.5" +-- Iteration 9 -- +string(12) "101234567000" +-- Iteration 10 -- + +Warning: ltrim() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: ltrim() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: ltrim() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- +string(1) "1" +-- Iteration 14 -- +string(0) "" +-- Iteration 15 -- +string(1) "1" +-- Iteration 16 -- +string(0) "" +-- Iteration 17 -- +string(0) "" +-- Iteration 18 -- +string(0) "" +-- Iteration 19 -- +string(15) "sample object " +-- Iteration 20 -- + +Warning: ltrim() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 21 -- +string(0) "" +-- Iteration 22 -- +string(0) "" +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/ltrim_variation2.phpt b/ext/standard/tests/strings/ltrim_variation2.phpt new file mode 100644 index 0000000000..194acd187f --- /dev/null +++ b/ext/standard/tests/strings/ltrim_variation2.phpt @@ -0,0 +1,138 @@ +--TEST-- +Test ltrim() function : usage variations - test values for $charlist argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing ltrim() function: with unexpected inputs for 'charlist' argument *** +-- Iteration 1 -- +string(19) "!---Hello World---!" +-- Iteration 2 -- +string(19) "!---Hello World---!" +-- Iteration 3 -- +string(19) "!---Hello World---!" +-- Iteration 4 -- +string(19) "!---Hello World---!" +-- Iteration 5 -- +string(19) "!---Hello World---!" +-- Iteration 6 -- +string(19) "!---Hello World---!" +-- Iteration 7 -- +string(19) "!---Hello World---!" +-- Iteration 8 -- +string(19) "!---Hello World---!" +-- Iteration 9 -- +string(19) "!---Hello World---!" +-- Iteration 10 -- + +Warning: ltrim() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: ltrim() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: ltrim() expects parameter 2 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- +string(19) "!---Hello World---!" +-- Iteration 14 -- +string(19) "!---Hello World---!" +-- Iteration 15 -- +string(19) "!---Hello World---!" +-- Iteration 16 -- +string(19) "!---Hello World---!" +-- Iteration 17 -- +string(19) "!---Hello World---!" +-- Iteration 18 -- +string(19) "!---Hello World---!" +-- Iteration 19 -- +string(19) "!---Hello World---!" +-- Iteration 20 -- + +Warning: ltrim() expects parameter 2 to be string, resource given in %s on line %d +NULL +-- Iteration 21 -- +string(19) "!---Hello World---!" +-- Iteration 22 -- +string(19) "!---Hello World---!" +===DONE=== \ No newline at end of file