Skip to content

Commit a1ceccf

Browse files
committed
Added test for memberExpression parsing
1 parent 66de9a4 commit a1ceccf

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎test/Parser.test.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ describe("Parser", function() {
4444
fghsub: ["notry"]
4545
}
4646
],
47+
"member expression": [
48+
function() {
49+
test[memberExpr]
50+
test[+memberExpr]
51+
},
52+
{
53+
expressions: ["memberExpr", "memberExpr"]
54+
}
55+
],
4756
"in function definition": [
4857
function() {
4958
(function(abc, cde, fgh) {
@@ -176,6 +185,11 @@ describe("Parser", function() {
176185
this.state.fghsub.push(this.scope.inTry ? "try" : "notry");
177186
return true;
178187
});
188+
testParser.plugin("expression memberExpr", function(expr) {
189+
if(!this.state.expressions) this.state.expressions = []
190+
this.state.expressions.push(expr.name);
191+
return true;
192+
});
179193
var actual = testParser.parse(source);
180194
should.strictEqual(typeof actual, "object");
181195
actual.should.be.eql(state);

0 commit comments

Comments
 (0)