Skip to content

Commit

Permalink
Added two tests for static property lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
bbtgp committed Oct 8, 2017
1 parent ad5702b commit 1368751
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/variableTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,36 @@ describe('Test variables', function() {
ast.children[0].left.kind.should.be.exactly('variable');
ast.children[0].left.name.should.be.exactly('?');
});

it('should fail on double static lookup', function() {
var astErr = parser.parseEval([
'this->foo::bar::baz;'
].join('\n'), {
parser: {
suppressErrors: true
}
});

var msg = 'Parse Error : syntax error, unexpected \'::\' (T_DOUBLE_COLON) on line 1';
astErr.errors.length.should.be.exactly(1);
astErr.errors[0].line.should.be.exactly(1);
astErr.errors[0].message.should.be.exactly(msg);
});

it('should fail on property lookup on static lookup', function() {
var astErr = parser.parseEval([
'this->foo::bar->baz;'
].join('\n'), {
parser: {
suppressErrors: true
}
});

var msg = 'Parse Error : syntax error, unexpected \'->\' (T_OBJECT_OPERATOR) on line 1';
astErr.errors.length.should.be.exactly(1);
astErr.errors[0].line.should.be.exactly(1);
astErr.errors[0].message.should.be.exactly(msg);
});

});
});

0 comments on commit 1368751

Please sign in to comment.