]> granicus.if.org Git - php/commitdiff
array copy on write tests
authorZoe Slattery <zoe@php.net>
Mon, 9 Jul 2007 13:23:37 +0000 (13:23 +0000)
committerZoe Slattery <zoe@php.net>
Mon, 9 Jul 2007 13:23:37 +0000 (13:23 +0000)
Zend/tests/array_append_COW.phpt [new file with mode: 0644]
Zend/tests/array_unshift_COW.phpt [new file with mode: 0644]

diff --git a/Zend/tests/array_append_COW.phpt b/Zend/tests/array_append_COW.phpt
new file mode 100644 (file)
index 0000000..e6c9926
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+ Tests that array manipulation code is correctly dealing with copy on write and
+ splitting on  reference.
+--FILE--
+<?php
+       $a=array();
+       $b=1;
+       $c=&$b;
+       $a[]=$b;
+       $b=2;
+       var_dump ($a);
+?>
+--EXPECT--
+array(1) {
+  [0]=>
+  int(1)
+}
\ No newline at end of file
diff --git a/Zend/tests/array_unshift_COW.phpt b/Zend/tests/array_unshift_COW.phpt
new file mode 100644 (file)
index 0000000..7c8beba
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+ Tests that array unshift code is correctly dealing with copy on write and
+ splitting on  reference.
+--FILE--
+<?php
+       $a=array();
+       $b=1;
+       $c=&$b;
+       array_unshift ($a,$b);
+       $b=2;
+       var_dump ($a);
+?>
+--EXPECT--
+array(1) {
+  [0]=>
+  int(1)
+}
\ No newline at end of file