]> granicus.if.org Git - php/commitdiff
split one more ten-in-one test
authorAntony Dovgal <tony2001@php.net>
Sun, 9 Sep 2007 22:28:06 +0000 (22:28 +0000)
committerAntony Dovgal <tony2001@php.net>
Sun, 9 Sep 2007 22:28:06 +0000 (22:28 +0000)
and fix \v\f stuff while we're here..

ext/standard/tests/strings/addcslashes.phpt [deleted file]
ext/standard/tests/strings/addcslashes_001.phpt [new file with mode: 0644]
ext/standard/tests/strings/addcslashes_002.phpt [new file with mode: 0644]
ext/standard/tests/strings/addcslashes_003.phpt [new file with mode: 0644]
ext/standard/tests/strings/addcslashes_004.phpt [new file with mode: 0644]

diff --git a/ext/standard/tests/strings/addcslashes.phpt b/ext/standard/tests/strings/addcslashes.phpt
deleted file mode 100644 (file)
index 9c6e035..0000000
Binary files a/ext/standard/tests/strings/addcslashes.phpt and /dev/null differ
diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt
new file mode 100644 (file)
index 0000000..ba45504
Binary files /dev/null and b/ext/standard/tests/strings/addcslashes_001.phpt differ
diff --git a/ext/standard/tests/strings/addcslashes_002.phpt b/ext/standard/tests/strings/addcslashes_002.phpt
new file mode 100644 (file)
index 0000000..eb46803
--- /dev/null
@@ -0,0 +1,33 @@
+--TEST--
+Test addcslashes() function (variation 2)
+--INI--
+precision=14
+--FILE--
+<?php
+
+$string = "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, "\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($obj, "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
new file mode 100644 (file)
index 0000000..f1d6581
Binary files /dev/null and b/ext/standard/tests/strings/addcslashes_003.phpt differ
diff --git a/ext/standard/tests/strings/addcslashes_004.phpt b/ext/standard/tests/strings/addcslashes_004.phpt
new file mode 100644 (file)
index 0000000..8f314fb
--- /dev/null
@@ -0,0 +1,30 @@
+--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("foo[]") );
+var_dump( addcslashes('foo[]', "o", "foo") );
+
+echo "Done\n"; 
+
+?>
+--EXPECTF--
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for addcslashes() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for addcslashes() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for addcslashes() in %s on line %d
+NULL
+Done