Skip to content

Commit 1368751

Browse files
committed
Added two tests for static property lookup
1 parent ad5702b commit 1368751

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/variableTests.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,36 @@ describe('Test variables', function() {
188188
ast.children[0].left.kind.should.be.exactly('variable');
189189
ast.children[0].left.name.should.be.exactly('?');
190190
});
191+
192+
it('should fail on double static lookup', function() {
193+
var astErr = parser.parseEval([
194+
'this->foo::bar::baz;'
195+
].join('\n'), {
196+
parser: {
197+
suppressErrors: true
198+
}
199+
});
200+
201+
var msg = 'Parse Error : syntax error, unexpected \'::\' (T_DOUBLE_COLON) on line 1';
202+
astErr.errors.length.should.be.exactly(1);
203+
astErr.errors[0].line.should.be.exactly(1);
204+
astErr.errors[0].message.should.be.exactly(msg);
205+
});
206+
207+
it('should fail on property lookup on static lookup', function() {
208+
var astErr = parser.parseEval([
209+
'this->foo::bar->baz;'
210+
].join('\n'), {
211+
parser: {
212+
suppressErrors: true
213+
}
214+
});
215+
216+
var msg = 'Parse Error : syntax error, unexpected \'->\' (T_OBJECT_OPERATOR) on line 1';
217+
astErr.errors.length.should.be.exactly(1);
218+
astErr.errors[0].line.should.be.exactly(1);
219+
astErr.errors[0].message.should.be.exactly(msg);
220+
});
221+
191222
});
192223
});

0 commit comments

Comments
 (0)