summaryrefslogtreecommitdiff
path: root/Zend/tests/constant_expressions.phpt
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2013-10-31 18:21:37 +0100
committerBob Weinand <bobwei9@hotmail.com>2013-10-31 18:21:37 +0100
commit466c5dd1fe194ab3d1634695e2dc96240f951f50 (patch)
tree4e2aaced8f7b16165e815c77025a381a56208db0 /Zend/tests/constant_expressions.phpt
parent2361745806553db9099542d9237ade00dcee799b (diff)
downloadphp-git-466c5dd1fe194ab3d1634695e2dc96240f951f50.tar.gz
Fixed mem leaks, added tests and ternary operator
Diffstat (limited to 'Zend/tests/constant_expressions.phpt')
-rw-r--r--Zend/tests/constant_expressions.phpt49
1 files changed, 49 insertions, 0 deletions
diff --git a/Zend/tests/constant_expressions.phpt b/Zend/tests/constant_expressions.phpt
new file mode 100644
index 0000000000..441b9a6f2a
--- /dev/null
+++ b/Zend/tests/constant_expressions.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Constant Expressions
+--FILE--
+<?php
+const T_1 = 1 << 1;
+const T_2 = 1 / 2;
+const T_3 = 1.5 + 1.5;
+const T_4 = "foo" . "bar";
+const T_5 = (1.5 + 1.5) * 2;
+const T_6 = "foo" . 2 . 3 . 4.0;
+const T_7 = __LINE__;
+const T_8 = <<<ENDOFSTRING
+This is a test string
+ENDOFSTRING;
+const T_9 = ~-1;
+const T_10 = (-1?:1) + (0?2:3);
+
+// Test order of operations
+const T_11 = 1 + 2 * 3;
+
+// Test for memory leaks
+const T_12 = "1" + 2 + "3";
+
+var_dump(T_1);
+var_dump(T_2);
+var_dump(T_3);
+var_dump(T_4);
+var_dump(T_5);
+var_dump(T_6);
+var_dump(T_7);
+var_dump(T_8);
+var_dump(T_9);
+var_dump(T_10);
+var_dump(T_11);
+var_dump(T_12);
+?>
+--EXPECT--
+int(2)
+float(0.5)
+float(3)
+string(6) "foobar"
+float(6)
+string(6) "foo234"
+int(8)
+string(21) "This is a test string"
+int(0)
+int(2)
+int(7)
+int(6)