@@ -87,7 +87,7 @@ describe('Test expressions', function() {
87
87
'$a > 5 ? true : false;' ,
88
88
'$a ?: false;'
89
89
] . join ( '\n' ) ) ;
90
- console . log ( ast . children [ 1 ] ) ;
90
+ // console.log(ast.children[1]);
91
91
ast . children [ 1 ] . kind . should . be . exactly ( 'retif' ) ;
92
92
93
93
} ) ;
@@ -209,6 +209,32 @@ describe('Test expressions', function() {
209
209
ast . children [ 3 ] . type . should . be . exactly ( '-' ) ;
210
210
} ) ;
211
211
212
+ it ( 'should fail to assign constants' , function ( ) {
213
+ var ast = parser . parseEval ( 'a = 1;' , {
214
+ parser : { debug : false , suppressErrors : true }
215
+ } ) ;
216
+ var msg = 'Parse Error : syntax error, unexpected \'=\' on line 1' ;
217
+ ast . errors . length . should . be . exactly ( 1 ) ;
218
+ ast . errors [ 0 ] . message . should . be . exactly ( msg ) ;
219
+ } ) ;
220
+
221
+ it ( 'should fail to assign class constants' , function ( ) {
222
+ var ast = parser . parseEval ( 'foo::b = 1;' , {
223
+ parser : { debug : false , suppressErrors : true }
224
+ } ) ;
225
+ var msg = 'Parse Error : syntax error, unexpected \'=\' on line 1' ;
226
+ ast . errors . length . should . be . exactly ( 1 ) ;
227
+ ast . errors [ 0 ] . message . should . be . exactly ( msg ) ;
228
+ } ) ;
229
+
230
+ it ( 'should assign class static' , function ( ) {
231
+ var ast = parser . parseEval ( 'a::$b = 1;' , {
232
+ parser : { debug : false , suppressErrors : true }
233
+ } ) ;
234
+ ast . errors . length . should . be . exactly ( 0 ) ;
235
+ ast . children [ 0 ] . kind . should . be . exactly ( 'assign' ) ;
236
+ } ) ;
237
+
212
238
it ( 'test new' , function ( ) {
213
239
var ast = parser . parseEval ( [
214
240
'$a = new \\foo();' ,
0 commit comments