diff options
| author | Antony Dovgal <tony2001@php.net> | 2007-09-09 22:47:23 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2007-09-09 22:47:23 +0000 |
| commit | b9faefee1445040d5588820c0700ede763105f1e (patch) | |
| tree | 21efd09882a8711c7c481034d9781c68f9c34580 | |
| parent | ff77b89984ad31e4cf98f177d83f7f69accf9ec3 (diff) | |
| download | php-git-b9faefee1445040d5588820c0700ede763105f1e.tar.gz | |
MFB: split test
| -rw-r--r-- | ext/standard/tests/strings/addcslashes_001.phpt | bin | 0 -> 1620 bytes | |||
| -rw-r--r-- | ext/standard/tests/strings/addcslashes_002.phpt | 33 | ||||
| -rw-r--r-- | ext/standard/tests/strings/addcslashes_003.phpt | bin | 0 -> 1618 bytes | |||
| -rw-r--r-- | ext/standard/tests/strings/addcslashes_004.phpt | 47 |
4 files changed, 80 insertions, 0 deletions
diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt Binary files differnew file mode 100644 index 0000000000..28a30aa52e --- /dev/null +++ b/ext/standard/tests/strings/addcslashes_001.phpt diff --git a/ext/standard/tests/strings/addcslashes_002.phpt b/ext/standard/tests/strings/addcslashes_002.phpt new file mode 100644 index 0000000000..33baa846d8 --- /dev/null +++ b/ext/standard/tests/strings/addcslashes_002.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test addcslashes() function (variation 2) +--INI-- +precision=14 +--FILE-- +<?php + +$string = b"goodyear12345NULL\0truefalse\a\v\f\b\n\r\t"; +/* charlist "\0..\37" would escape all characters with ASCII code between 0 and 31 */ +echo "\n*** Testing addcslashes() with ASCII code between 0 and 31 ***\n"; +var_dump( addcslashes($string, b"\0..\37") ); + +/* Checking OBJECTS type */ +echo "\n*** Testing addcslashes() with objects ***\n"; +class string1 +{ + public function __toString() { + return "Object"; + } +} +$obj = new string1; +var_dump( addcslashes((binary)$obj, b"b") ); + +echo "Done\n"; + +?> +--EXPECTF-- +*** Testing addcslashes() with ASCII code between 0 and 31 *** +string(44) "goodyear12345NULL\000truefalse\a\v\f\b\n\r\t" + +*** Testing addcslashes() with objects *** +string(7) "O\bject" +Done diff --git a/ext/standard/tests/strings/addcslashes_003.phpt b/ext/standard/tests/strings/addcslashes_003.phpt Binary files differnew file mode 100644 index 0000000000..10b1e99738 --- /dev/null +++ b/ext/standard/tests/strings/addcslashes_003.phpt diff --git a/ext/standard/tests/strings/addcslashes_004.phpt b/ext/standard/tests/strings/addcslashes_004.phpt new file mode 100644 index 0000000000..ba553a2688 --- /dev/null +++ b/ext/standard/tests/strings/addcslashes_004.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test addcslashes() function (errors) +--INI-- +precision=14 +--FILE-- +<?php + +echo "\n*** Testing error conditions ***\n"; +/* zero argument */ +var_dump( addcslashes() ); + +/* unexpected arguments */ +var_dump( addcslashes(b"foo[]") ); +var_dump( addcslashes("foo", "foo") ); +var_dump( addcslashes(b'foo[]', b"o", b"foo") ); + +echo "Done\n"; + +?> +--EXPECTF-- +*** Testing error conditions *** + +Warning: addcslashes() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: addcslashes() expects exactly 2 parameters, 1 given in %s on line %d +NULL +string(6) "\f\o\o" + +Warning: addcslashes() expects exactly 2 parameters, 3 given in %s on line %d +NULL +Done +--UEXPECTF-- +*** Testing error conditions *** + +Warning: addcslashes() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: addcslashes() expects exactly 2 parameters, 1 given in %s on line %d +NULL + +Warning: addcslashes() expects parameter 1 to be strictly a binary string, Unicode string given in %s on line %d +NULL + +Warning: addcslashes() expects exactly 2 parameters, 3 given in %s on line %d +NULL +Done |
