Skip to content

Commit a8cbde6

Browse files
committed
improve parser coverage
1 parent f504ddd commit a8cbde6

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

test/exprTests.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ describe('Test expressions', function() {
204204

205205
it('test new', function() {
206206
var ast = parser.parseEval([
207-
'$a = new foo();',
207+
'$a = new \\foo();',
208+
'$a = new namespace\\foo::class();',
208209
'$a = new $foo();',
209210
'$a = new class extends foo implements bar { };',
210211
].join('\n'), {
@@ -213,11 +214,11 @@ describe('Test expressions', function() {
213214
ast.children[0].right.kind.should.be.exactly('new');
214215
ast.children[0].right.what.kind.should.be.exactly('identifier');
215216

216-
ast.children[1].right.kind.should.be.exactly('new');
217-
ast.children[1].right.what.kind.should.be.exactly('variable');
218-
219217
ast.children[2].right.kind.should.be.exactly('new');
220-
ast.children[2].right.what.kind.should.be.exactly('class');
218+
ast.children[2].right.what.kind.should.be.exactly('variable');
219+
220+
ast.children[3].right.kind.should.be.exactly('new');
221+
ast.children[3].right.what.kind.should.be.exactly('class');
221222
});
222223

223224
it('test nested expressions precedence', function() {

test/scalarTests.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ describe('Test scalar statements', function() {
1010
debug: true
1111
}
1212
});
13-
console.log(ast);
13+
// @todo assert console.log(ast);
14+
15+
});
16+
it('dereferencable', function() {
17+
var ast = parser.parseEval([
18+
'$a = foo::bar()[5]->test;',
19+
'$b = (new test())->foo();',
20+
'$c = (foo())[5];',
21+
'$d = (function($a) { return $a * 2; })(5);',
22+
].join('\n'), {
23+
parser: {
24+
debug: true
25+
}
26+
});
27+
1428
});
1529
});

0 commit comments

Comments
 (0)