From: Raghubansh Kumar Date: Sat, 29 Sep 2007 16:49:41 +0000 (+0000) Subject: New testcases for chunk_split() function X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND_IN_5_3~56 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=482eabc6b60b37d69c3cdb7db0e1a1fbfd17948f;p=php New testcases for chunk_split() function --- diff --git a/ext/standard/tests/strings/chunk_split_basic.phpt b/ext/standard/tests/strings/chunk_split_basic.phpt new file mode 100644 index 0000000000..14ad782ac0 --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_basic.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test chunk_split() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : basic functionality *** +-- Testing chunk_split() with all possible arguments -- +string(15) "Te##st##in##g##" +-- Testing chunk_split() with default ending string -- +string(15) "Te +st +in +g +" +-- Testing chunk_split() with default chunklen and ending string -- +string(9) "Testing +" +Done diff --git a/ext/standard/tests/strings/chunk_split_error.phpt b/ext/standard/tests/strings/chunk_split_error.phpt new file mode 100644 index 0000000000..153250c1ae --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test chunk_split() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : error conditions *** +-- Testing chunk_split() function with Zero arguments -- +Warning: Wrong parameter count for chunk_split() in %s on line %d +NULL +-- Testing chunk_split() function with more than expected no. of arguments -- +Warning: Wrong parameter count for chunk_split() in %s on line %d +NULL +Done diff --git a/ext/standard/tests/strings/chunk_split_variation1.phpt b/ext/standard/tests/strings/chunk_split_variation1.phpt new file mode 100644 index 0000000000..e554d8a844 --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation1.phpt @@ -0,0 +1,167 @@ +--TEST-- +Test chunk_split() function : usage variations - with unexpected values for 'str' argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new MyClass(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource data + $fp +); + +// loop through each element of the array for 'str' +for($count = 0; $count < count($values); $count++) { + echo "-- Iteration ".($count+1)." --\n"; + var_dump( chunk_split($values[$count], $chunklen, $ending) ); +}; + +echo "Done"; + +// close the resource +fclose($fp); + +?> +--EXPECTF-- +*** Testing chunk_split() : with unexpected values for 'str' argument *** +-- Iteration 1 -- +string(2) "0 " +-- Iteration 2 -- +string(2) "1 " +-- Iteration 3 -- +string(8) "12 34 5 " +-- Iteration 4 -- +string(8) "-2 34 5 " +-- Iteration 5 -- +string(6) "10 .5 " +-- Iteration 6 -- +string(8) "-1 0. 5 " +-- Iteration 7 -- +string(18) "10 50 00 00 00 00 " +-- Iteration 8 -- +string(11) "1. 06 E- 9 " +-- Iteration 9 -- +string(5) "0. 5 " +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +string(8) "Ar ra y " +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(8) "Ar ra y " +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(8) "Ar ra y " +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(8) "Ar ra y " +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(8) "Ar ra y " +-- Iteration 15 -- +string(1) " " +-- Iteration 16 -- +string(1) " " +-- Iteration 17 -- +string(2) "1 " +-- Iteration 18 -- +string(1) " " +-- Iteration 19 -- +string(2) "1 " +-- Iteration 20 -- +string(1) " " +-- Iteration 21 -- +string(1) " " +-- Iteration 22 -- +string(1) " " +-- Iteration 23 -- +string(9) "st ri ng " +-- Iteration 24 -- +string(9) "st ri ng " +-- Iteration 25 -- +string(9) "ob je ct " +-- Iteration 26 -- +string(1) " " +-- Iteration 27 -- +string(1) " " +-- Iteration 28 -- +string(21) "Re so ur ce i d #5 " +Done diff --git a/ext/standard/tests/strings/chunk_split_variation10.phpt b/ext/standard/tests/strings/chunk_split_variation10.phpt new file mode 100644 index 0000000000..36b9fe8a05 --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation10.phpt @@ -0,0 +1,86 @@ +--TEST-- +Test chunk_split() function : usage variations - different single quoted strings for 'ending' argument +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : different single quoted strings as 'ending' *** +-- Iteration 0 -- +string(73) "This is to test chunk_split() with various 'single quoted' ending string." +-- Iteration 1 -- +string(82) "This is t o test ch unk_split () with v arious 's ingle quo ted' endi ng string . " +-- Iteration 2 -- +string(82) "This is tao test chaunk_splita() with vaarious 'saingle quoated' endiang stringa.a" +-- Iteration 3 -- +string(127) "This is tENDINGo test chENDINGunk_splitENDING() with vENDINGarious 'sENDINGingle quoENDINGted' endiENDINGng stringENDING.ENDING" +-- Iteration 4 -- +string(118) "This is t@#$%^o test ch@#$%^unk_split@#$%^() with v@#$%^arious 's@#$%^ingle quo@#$%^ted' endi@#$%^ng string@#$%^.@#$%^" +-- Iteration 5 -- +string(91) "This is t\to test ch\tunk_split\t() with v\tarious 's\tingle quo\tted' endi\tng string\t.\t" +-- Iteration 6 -- +string(91) "This is t\no test ch\nunk_split\n() with v\narious 's\ningle quo\nted' endi\nng string\n.\n" +-- Iteration 7 -- +string(91) "This is t\ro test ch\runk_split\r() with v\rarious 's\ringle quo\rted' endi\rng string\r.\r" +-- Iteration 8 -- +string(109) "This is t\r\no test ch\r\nunk_split\r\n() with v\r\narious 's\r\ningle quo\r\nted' endi\r\nng string\r\n.\r\n" +-- Iteration 9 -- +string(91) "This is t\0o test ch\0unk_split\0() with v\0arious 's\0ingle quo\0ted' endi\0ng string\0.\0" +-- Iteration 10 -- +string(100) "This is t123o test ch123unk_split123() with v123arious 's123ingle quo123ted' endi123ng string123.123" +-- Iteration 11 -- +string(118) "This is t(MSG)o test ch(MSG)unk_split(MSG)() with v(MSG)arious 's(MSG)ingle quo(MSG)ted' endi(MSG)ng string(MSG).(MSG)" +-- Iteration 12 -- +string(226) "This is t) ending string (o test ch) ending string (unk_split) ending string (() with v) ending string (arious 's) ending string (ingle quo) ending string (ted' endi) ending string (ng string) ending string (.) ending string (" +-- Iteration 13 -- +string(217) "This is t) numbers 1234 (o test ch) numbers 1234 (unk_split) numbers 1234 (() with v) numbers 1234 (arious 's) numbers 1234 (ingle quo) numbers 1234 (ted' endi) numbers 1234 (ng string) numbers 1234 (.) numbers 1234 (" +-- Iteration 14 -- +string(226) "This is t) speci@! ch@r$ (o test ch) speci@! ch@r$ (unk_split) speci@! ch@r$ (() with v) speci@! ch@r$ (arious 's) speci@! ch@r$ (ingle quo) speci@! ch@r$ (ted' endi) speci@! ch@r$ (ng string) speci@! ch@r$ (.) speci@! ch@r$ (" +Done diff --git a/ext/standard/tests/strings/chunk_split_variation11.phpt b/ext/standard/tests/strings/chunk_split_variation11.phpt new file mode 100644 index 0000000000..418e607f4c --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation11.phpt @@ -0,0 +1,95 @@ +--TEST-- +Test chunk_split() function : usage variations - different strings for 'ending' with heredoc 'str' +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : different values for 'ending' with heredoc 'str'*** +-- Iteration 1 -- +string(113) "This is heredoc string with and +.It also contains +sPeci@! ch@r$ :) & numbers 222.This is \k wrong escape char." +-- Iteration 2 -- +string(132) "This i s here doc st ring w ith and +. It als o cont ains +s Peci@! ch@r$ :) & number s 222. This i s \k w rong e scape char. " +-- Iteration 3 -- +string(132) "This ias hereadoc staring waith aand +.aIt alsao contaains +saPeci@!a ch@r$a :) & anumberas 222.aThis ias \k warong eascape achar.a" +-- Iteration 4 -- +string(227) "This iENDINGs hereENDINGdoc stENDINGring wENDINGith ENDINGand +.ENDINGIt alsENDINGo contENDINGains +sENDINGPeci@!ENDING ch@r$ENDING :) & ENDINGnumberENDINGs 222.ENDINGThis iENDINGs \k wENDINGrong eENDINGscape ENDINGchar.ENDING" +-- Iteration 5 -- +string(151) "This i +s here +doc st +ring w +ith +and +. +It als +o cont +ains +s +Peci@! + ch@r$ + :) & +number +s 222. +This i +s \k w +rong e +scape +char. +" +-- Iteration 6 -- +string(170) "This i123s here123doc st123ring w123ith 123and +.123It als123o cont123ains +s123Peci@!123 ch@r$123 :) & 123number123s 222.123This i123s \k w123rong e123scape 123char.123" +-- Iteration 7 -- +string(398) "This i)speci@! ch@r$(s here)speci@! ch@r$(doc st)speci@! ch@r$(ring w)speci@! ch@r$(ith )speci@! ch@r$(and +.)speci@! ch@r$(It als)speci@! ch@r$(o cont)speci@! ch@r$(ains +s)speci@! ch@r$(Peci@!)speci@! ch@r$( ch@r$)speci@! ch@r$( :) & )speci@! ch@r$(number)speci@! ch@r$(s 222.)speci@! ch@r$(This i)speci@! ch@r$(s \k w)speci@! ch@r$(rong e)speci@! ch@r$(scape )speci@! ch@r$(char.)speci@! ch@r$(" +Done diff --git a/ext/standard/tests/strings/chunk_split_variation12.phpt b/ext/standard/tests/strings/chunk_split_variation12.phpt new file mode 100644 index 0000000000..e90287546a --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation12.phpt @@ -0,0 +1,145 @@ +--TEST-- +Test chunk_split() function : usage variations - different heredoc strings for 'ending' argument +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : different heredoc strings for 'ending' argument *** +-- Iteration 1 -- +string(102) "This is str to check with heredoc ending.This contains, +speci@! ch@r$ __with wrong \k escape char 222." +-- Iteration 2 -- +string(102) "This is str to check with heredoc ending.This contains, +speci@! ch@r$ __with wrong \k escape char 222." +-- Iteration 3 -- +string(113) "This is star to checka with hereadoc endinga.This contaains, +specai@! ch@r$ a__with wroang \k escaape char 22a2.a" +-- Iteration 4 -- +string(421) "This is stThis is simple heredoc stringr to checkThis is simple heredoc string with hereThis is simple heredoc stringdoc endingThis is simple heredoc string.This contThis is simple heredoc stringains, +specThis is simple heredoc stringi@! ch@r$ This is simple heredoc string__with wroThis is simple heredoc stringng \k escaThis is simple heredoc stringpe char 22This is simple heredoc string2.This is simple heredoc string" +-- Iteration 5 -- +string(762) "This is stThis is to check chunk_split +function with multiline +heredocr to checkThis is to check chunk_split +function with multiline +heredoc with hereThis is to check chunk_split +function with multiline +heredocdoc endingThis is to check chunk_split +function with multiline +heredoc.This contThis is to check chunk_split +function with multiline +heredocains, +specThis is to check chunk_split +function with multiline +heredoci@! ch@r$ This is to check chunk_split +function with multiline +heredoc__with wroThis is to check chunk_split +function with multiline +heredocng \k escaThis is to check chunk_split +function with multiline +heredocpe char 22This is to check chunk_split +function with multiline +heredoc2.This is to check chunk_split +function with multiline +heredoc" +-- Iteration 6 -- +string(443) "This is stThis checks with $, %, &, charsr to checkThis checks with $, %, &, chars with hereThis checks with $, %, &, charsdoc endingThis checks with $, %, &, chars.This contThis checks with $, %, &, charsains, +specThis checks with $, %, &, charsi@! ch@r$ This checks with $, %, &, chars__with wroThis checks with $, %, &, charsng \k escaThis checks with $, %, &, charspe char 22This checks with $, %, &, chars2.This checks with $, %, &, chars" +-- Iteration 7 -- +string(487) "This is stThis checks and +white space charsr to checkThis checks and +white space chars with hereThis checks and +white space charsdoc endingThis checks and +white space chars.This contThis checks and +white space charsains, +specThis checks and +white space charsi@! ch@r$ This checks and +white space chars__with wroThis checks and +white space charsng \k escaThis checks and +white space charspe char 22This checks and +white space chars2.This checks and +white space chars" +-- Iteration 8 -- +string(597) "This is st"To check " in heredoc".I'm sure it'll \work!r to check"To check " in heredoc".I'm sure it'll \work! with here"To check " in heredoc".I'm sure it'll \work!doc ending"To check " in heredoc".I'm sure it'll \work!.This cont"To check " in heredoc".I'm sure it'll \work!ains, +spec"To check " in heredoc".I'm sure it'll \work!i@! ch@r$ "To check " in heredoc".I'm sure it'll \work!__with wro"To check " in heredoc".I'm sure it'll \work!ng \k esca"To check " in heredoc".I'm sure it'll \work!pe char 22"To check " in heredoc".I'm sure it'll \work!2."To check " in heredoc".I'm sure it'll \work!" +Done diff --git a/ext/standard/tests/strings/chunk_split_variation13.phpt b/ext/standard/tests/strings/chunk_split_variation13.phpt new file mode 100644 index 0000000000..3cbcbe466d --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation13.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test chunk_split() function : usage variations - default 'chunklen' with long string as 'str'argument +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : default 'chunklen' with long string 'str' *** +-- Iteration 0 -- +string(85) "1234567890123456789012345678901234567890123456789012345678901234567890123456 +78901 +" +-- Iteration 1 -- +string(217) "1234567890123456789012345678901234567890123456789012345678901234567890123456 +7890123456789012345678901234567890123456789012345678901234567890123456789012 +34567890123456789012345678901234567890123456789012345678901 +" +Done diff --git a/ext/standard/tests/strings/chunk_split_variation2.phpt b/ext/standard/tests/strings/chunk_split_variation2.phpt new file mode 100644 index 0000000000..3498f5fce6 --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation2.phpt @@ -0,0 +1,172 @@ +--TEST-- +Test chunk_split() function : usage variations - unexpected values for 'chunklen' argument(Bug#42796) +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new MyClass(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource variable + $fp +); + +// loop through each element of the values for 'chunklen' +for($count = 0; $count < count($values); $count++) { + echo "-- Iteration ".($count+1)." --\n"; + var_dump( chunk_split($str, $values[$count], $ending) ); +} + +echo "Done"; + +//closing resource +fclose($fp); + +?> +--EXPECTF-- +*** Testing chunk_split() : with unexpected values for 'chunklen' argument *** +-- Iteration 1 -- +string(28) "This is ch*uklen vari*ation*" +-- Iteration 2 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 3 -- +string(26) "This is chuklen variation*" +-- Iteration 4 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 7 -- +string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*" +-- Iteration 8 -- +string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*" +-- Iteration 9 -- +string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*" +-- Iteration 10 -- +string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*" +-- Iteration 11 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 13 -- +string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*" +-- Iteration 14 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 15 -- +string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*" +-- Iteration 16 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 19 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 20 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 21 -- + +Notice: Object of class MyClass could not be converted to int in %s on line %d +string(50) "T*h*i*s* *i*s* *c*h*u*k*l*e*n* *v*a*r*i*a*t*i*o*n*" +-- Iteration 22 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 24 -- +string(30) "This *is ch*uklen* vari*ation*" +Done diff --git a/ext/standard/tests/strings/chunk_split_variation3.phpt b/ext/standard/tests/strings/chunk_split_variation3.phpt new file mode 100644 index 0000000000..ab2e671aae --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation3.phpt @@ -0,0 +1,158 @@ +--TEST-- +Test chunk_split() function : usage variations - unexpected values for 'ending' argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new MyClass(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource data + $fp +); + +// loop through each element of values for 'ending' +for($count = 0; $count < count($values); $count++) { + echo "-- Iteration ".($count+1)." --\n"; + var_dump( chunk_split($str, $chunklen, $values[$count]) ); +} + +echo "Done"; + +//closing resource +fclose($fp); +?> +--EXPECTF-- +*** Testing chunk_split() : unexpected values for 'ending' *** +-- Iteration 1 -- +string(28) "This0 is 0simp0le s0trin0g.0" +-- Iteration 2 -- +string(28) "This1 is 1simp1le s1trin1g.1" +-- Iteration 3 -- +string(52) "This12345 is 12345simp12345le s12345trin12345g.12345" +-- Iteration 4 -- +string(52) "This-2345 is -2345simp-2345le s-2345trin-2345g.-2345" +-- Iteration 5 -- +string(46) "This10.5 is 10.5simp10.5le s10.5trin10.5g.10.5" +-- Iteration 6 -- +string(52) "This-10.5 is -10.5simp-10.5le s-10.5trin-10.5g.-10.5" +-- Iteration 7 -- +string(94) "This105000000000 is 105000000000simp105000000000le s105000000000trin105000000000g.105000000000" +-- Iteration 8 -- +string(64) "This1.06E-9 is 1.06E-9simp1.06E-9le s1.06E-9trin1.06E-9g.1.06E-9" +-- Iteration 9 -- +string(40) "This0.5 is 0.5simp0.5le s0.5trin0.5g.0.5" +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(52) "ThisArray is ArraysimpArrayle sArraytrinArrayg.Array" +-- Iteration 15 -- +string(22) "This is simple string." +-- Iteration 16 -- +string(22) "This is simple string." +-- Iteration 17 -- +string(28) "This1 is 1simp1le s1trin1g.1" +-- Iteration 18 -- +string(22) "This is simple string." +-- Iteration 19 -- +string(28) "This1 is 1simp1le s1trin1g.1" +-- Iteration 20 -- +string(22) "This is simple string." +-- Iteration 21 -- +string(22) "This is simple string." +-- Iteration 22 -- +string(22) "This is simple string." +-- Iteration 23 -- +string(58) "Thisobject is objectsimpobjectle sobjecttrinobjectg.object" +-- Iteration 24 -- +string(22) "This is simple string." +-- Iteration 25 -- +string(22) "This is simple string." +-- Iteration 26 -- +string(106) "ThisResource id #5 is Resource id #5simpResource id #5le sResource id #5trinResource id #5g.Resource id #5" +Done diff --git a/ext/standard/tests/strings/chunk_split_variation4.phpt b/ext/standard/tests/strings/chunk_split_variation4.phpt new file mode 100644 index 0000000000..120a994f50 --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation4.phpt @@ -0,0 +1,177 @@ +--TEST-- +Test chunk_split() function : usage variations - different heredoc strings as 'str' argument +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : heredoc strings as 'str' argument *** +-- Iteration 1 -- +string(2) " +" +-- Iteration 2 -- +string(2) " +" +-- Iteration 3 -- +string(3) "a +" +-- Iteration 4 -- +string(45) "This + is +simp +le h +ered +oc s +trin +g +" +-- Iteration 5 -- +string(90) "This + is +to c +heck + chu +nk_s +plit + +fun +ctio +n wi +th m +ulti +line + +her +edoc +" +-- Iteration 6 -- +string(59) "This + che +cks +here +doc +with + $, +%, & +, ch +ars +" +-- Iteration 7 -- +string(59) "This + che +cks + chu +nk_s +plit +() +E +scap +e +ch +ars +" +-- Iteration 8 -- +string(117) ""To +chec +k " +in h +ered +oc" + +I'm +sure + it' +ll w +ork +also + wit +h \ + +whic +h is + sin +gle +slas +h +" +Done diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt new file mode 100644 index 0000000000..69308ea309 Binary files /dev/null and b/ext/standard/tests/strings/chunk_split_variation5.phpt differ diff --git a/ext/standard/tests/strings/chunk_split_variation6.phpt b/ext/standard/tests/strings/chunk_split_variation6.phpt new file mode 100644 index 0000000000..705bb31fca --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation6.phpt @@ -0,0 +1,76 @@ +--TEST-- +Test chunk_split() function : usage variations - single quoted strings for 'str' argument +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : with different single quoted 'str' *** +-- Iteration 0 -- +string(3) "):(" +-- Iteration 1 -- +string(4) " ):(" +-- Iteration 2 -- +string(30) "This is):( simple):( string):(" +-- Iteration 3 -- +string(35) "It's st):(ring wi):(th quot):(es):(" +-- Iteration 4 -- +string(46) "This co):(ntains ):(@ # $ %):( ^ & ch):(ars):(" +-- Iteration 5 -- +string(59) "This st):(ring\tc):(ontains):(\rwhite):( space\):(nchars):(" +-- Iteration 6 -- +string(47) "This is):( string):( with 1):(234 num):(bers):(" +-- Iteration 7 -- +string(68) "This is):( string):( with \):(0 and "):(.chr(0)):(."null ):(chars):(" +-- Iteration 8 -- +string(74) "This is):( string):( with ):( multi):(ple ):( sp):(ace cha):(r):(" +-- Iteration 9 -- +string(46) "This is):( to che):(ck stri):(ng with):( ()):(" +-- Iteration 10 -- +string(59) " Te):(sting w):(ith ):(multipl):(e space):(s ):(" +-- Iteration 11 -- +string(55) "Testing):( invali):(d \k an):(d \m es):(cape ch):(ar):(" +-- Iteration 12 -- +string(46) "This is):( to che):(ck with):( \n and):( \t):(" +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/chunk_split_variation7.phpt b/ext/standard/tests/strings/chunk_split_variation7.phpt new file mode 100644 index 0000000000..9253f0e716 Binary files /dev/null and b/ext/standard/tests/strings/chunk_split_variation7.phpt differ diff --git a/ext/standard/tests/strings/chunk_split_variation8.phpt b/ext/standard/tests/strings/chunk_split_variation8.phpt new file mode 100644 index 0000000000..cc6eeef98c --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation8.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test chunk_split() function : usage variations - different integer values for 'chunklen' with heredoc string as 'str'(Bug#42796) +--FILE-- + +--EXPECTF-- +*** Testing chunk_split() : different 'chunklen' with heredoc 'str' *** +-- Iteration 1 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 2 -- +string(504) "T:::h:::i:::s:::':::s::: :::h:::e:::r:::e:::d:::o:::c::: :::s:::t:::r:::i:::n:::g::: :::w:::i:::t:::h::: ::: ::: :::a:::n:::d::: ::: +::: :::w:::h:::i:::t:::e::: :::s:::p:::a:::c:::e::: :::c:::h:::a:::r:::.::: +:::I:::t::: :::h:::a:::s::: :::_:::s:::p:::e:::c:::i:::@:::l::: :::c:::h:::@:::r:::$::: :::2:::2:::2:::2::: :::!:::!:::!:::N:::o:::w::: :::\:::k::: :::a:::s::: :::e:::s:::c:::a:::p:::e::: :::c:::h:::a:::r::: :::t:::o::: :::t:::e:::s:::t::: +:::c:::h:::u:::n:::k:::_:::s:::p:::l:::i:::t:::(:::):::" +-- Iteration 3 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 4 -- +string(129) "This's heredoc string with and + white space char. +It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test +chunk_split():::" +-- Iteration 5 -- +string(141) "This's heredoc string with::: and + white space char.::: +It has _speci@l ch@r$ 222:::2 !!!Now \k as escape char::: to test +chunk_split():::" +-- Iteration 6 -- +string(129) "This's heredoc string with and + white space char. +It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test +chunk_split():::" +-- Iteration 7 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +-- Iteration 8 -- + +Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/strings/chunk_split_variation9.phpt b/ext/standard/tests/strings/chunk_split_variation9.phpt new file mode 100644 index 0000000000..b576b0e99c Binary files /dev/null and b/ext/standard/tests/strings/chunk_split_variation9.phpt differ