File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ module.exports = {
14
14
this . unput ( 1 ) ;
15
15
} else if ( this . is_LABEL_START ( ) ) {
16
16
this . consume_LABEL ( ) ;
17
+ this . popState ( ) ;
17
18
return this . tok . T_STRING ;
18
19
}
19
20
this . popState ( ) ;
Original file line number Diff line number Diff line change @@ -30,8 +30,24 @@ describe('Test strings', function() {
30
30
it ( '...' , function ( ) {
31
31
var ast = parser . parseEval ( 'echo "~\'.{{$expectedLength}}\'\\$~s";' ) ;
32
32
} ) ;
33
- it ( '...' , function ( ) {
34
- var ast = parser . parseEval ( 'echo "Hello \\"$obj->name\\" !";' ) ;
33
+ it ( 'test encapsed variable' , function ( ) {
34
+ var ast = parser . parseEval ( [
35
+ 'echo "Hello $obj->name !";' ,
36
+ 'echo "Hello $obj->foo->bar !";' ,
37
+ 'echo "Hello $obj[1]->foo !";'
38
+ ] . join ( '\n' ) ) ;
39
+
40
+ ast . children [ 0 ] . arguments [ 0 ] . kind . should . be . exactly ( 'encapsed' ) ;
41
+ ast . children [ 0 ] . arguments [ 0 ] . value [ 0 ] . value . should . be . exactly ( 'Hello ' ) ;
42
+ ast . children [ 0 ] . arguments [ 0 ] . value [ 2 ] . value . should . be . exactly ( ' !' ) ;
43
+
44
+ ast . children [ 1 ] . arguments [ 0 ] . kind . should . be . exactly ( 'encapsed' ) ;
45
+ ast . children [ 1 ] . arguments [ 0 ] . value [ 0 ] . value . should . be . exactly ( 'Hello ' ) ;
46
+ ast . children [ 1 ] . arguments [ 0 ] . value [ 2 ] . value . should . be . exactly ( '->bar !' ) ;
47
+
48
+ ast . children [ 2 ] . arguments [ 0 ] . kind . should . be . exactly ( 'encapsed' ) ;
49
+ ast . children [ 2 ] . arguments [ 0 ] . value [ 0 ] . value . should . be . exactly ( 'Hello ' ) ;
50
+ ast . children [ 2 ] . arguments [ 0 ] . value [ 2 ] . value . should . be . exactly ( '->foo !' ) ;
35
51
} ) ;
36
52
it ( '...' , function ( ) {
37
53
var ast = parser . parseEval ( 'echo "Hello {".$obj->name."} !";' ) ;
You can’t perform that action at this time.
0 commit comments