com php-src: Extended coalesce operator test case for ordering/short-circuiting: tests/lang/operators/coalesce.phpt
| From: | ajf@php.net | Date: | Tue, 23 Sep 2014 15:28:02 +0000 |
| Subject: | com php-src: Extended coalesce operator test case for ordering/short-circuiting: tests/lang/operators/coalesce.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81987@lists.php.net to get a copy of this message | ||
Commit: ec39802e4e7dac14b629f41017d04573a6a5fdc4
Author: Andrea Faulds <ajf@ajf.me> Tue, 23 Sep 2014 16:28:02 +0100
Parents: 157da54e8236f939ed79fa9f91a2c9f4dd08fc68
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ec39802e4e7dac14b629f41017d04573a6a5fdc4
Log:
Extended coalesce operator test case for ordering/short-circuiting
Changed paths:
M tests/lang/operators/coalesce.phpt
Diff:
diff --git a/tests/lang/operators/coalesce.phpt b/tests/lang/operators/coalesce.phpt
index 327a11a..2ee54c5 100644
--- a/tests/lang/operators/coalesce.phpt
+++ b/tests/lang/operators/coalesce.phpt
@@ -42,6 +42,14 @@ var_dump($arr["bing"][0] ?? 3);
var_dump($arr["bing"][1] ?? 3);
echo PHP_EOL;
var_dump(foobar()[0] ?? false);
+echo PHP_EOL;
+function f($x)
+{
+ printf("%s(%d)\n", __FUNCTION__, $x);
+ return $x;
+}
+
+$a = f(null) ?? f(1) ?? f(2);
?>
--EXPECTF--
int(3)
@@ -65,4 +73,7 @@ string(4) "bang"
int(3)
called
-string(1) "a"
\ No newline at end of file
+string(1) "a"
+
+f(0)
+f(1)
\ No newline at end of file