File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
src/test/php/lang/ast/unittest/emit Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php namespace lang \ast \unittest \emit ;
2
+
3
+ class BracesTest extends EmittingTest {
4
+
5
+ #[@test]
6
+ public function inc () {
7
+ $ r = $ this ->run ('class <T> {
8
+ private $id= 0;
9
+
10
+ public function run() {
11
+ return "test".(++$this->id);
12
+ }
13
+ } ' );
14
+
15
+ $ this ->assertEquals ('test1 ' , $ r );
16
+ }
17
+
18
+ #[@test]
19
+ public function no_braces_necessary_around_new () {
20
+ $ r = $ this ->run ('class <T> {
21
+ public function run() {
22
+ return new \\util \\Date(250905600)->getTime();
23
+ }
24
+ } ' );
25
+
26
+ $ this ->assertEquals (250905600 , $ r );
27
+ }
28
+
29
+ #[@test]
30
+ public function property_vs_method_ambiguity () {
31
+ $ r = $ this ->run ('class <T> {
32
+ private $f;
33
+
34
+ public function __construct() {
35
+ $this->f= function($arg) { return $arg; };
36
+ }
37
+
38
+ public function run() {
39
+ return ($this->f)("test");
40
+ }
41
+ } ' );
42
+
43
+ $ this ->assertEquals ('test ' , $ r );
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments