com php-src: Forgot to git add two tests: Zend/tests/generators /close_inside_generator.phpt Zend/tests/generators/func _get_args.phpt
| From: | Gustavo André dos Santos Lopes | Date: | Mon, 25 Jun 2012 19:41:50 +0000 |
| Subject: | com php-src: Forgot to git add two tests: Zend/tests/generators /close_inside_generator.phpt Zend/tests/generators/func _get_args.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-70044@lists.php.net to get a copy of this message | ||
Commit: 5a9bddba6699d056383107728392048cd7ccb598
Author: Nikita Popov <nikic@php.net> Mon, 25 Jun 2012 21:41:50 +0200
Parents: ab75ed6ba9b5eace710976bf76d631728d4bb403
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5a9bddba6699d056383107728392048cd7ccb598
Log:
Forgot to git add two tests
Changed paths:
A Zend/tests/generators/close_inside_generator.phpt
A Zend/tests/generators/func_get_args.phpt
Diff:
diff --git a/Zend/tests/generators/close_inside_generator.phpt
b/Zend/tests/generators/close_inside_generator.phpt
new file mode 100644
index 0000000..41a91c9
--- /dev/null
+++ b/Zend/tests/generators/close_inside_generator.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Calling close() during the exectution of the generator
+--FILE--
+<?php
+
+function *gen() {
+ /* Pass the generator object itself in */
+ $gen = yield;
+
+ /* Close generator while it is currently running */
+ $gen->close();
+
+ echo "Still running";
+}
+
+$gen = gen();
+$gen->send($gen);
+
+?>
+--EXPECTF--
+Warning: A generator cannot be closed while it is running in %s on line %d
+Still running
diff --git a/Zend/tests/generators/func_get_args.phpt b/Zend/tests/generators/func_get_args.phpt
new file mode 100644
index 0000000..7ce7fb0
--- /dev/null
+++ b/Zend/tests/generators/func_get_args.phpt
@@ -0,0 +1,20 @@
+--TEST--
+func_get_args() can be used inside generator functions
+--FILE--
+<?php
+
+function *gen() {
+ var_dump(func_get_args());
+}
+
+$gen = gen("foo", "bar");
+$gen->rewind();
+
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+}