Skip to content

Commit

Permalink
revise testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Oct 8, 2021
1 parent 6cdaa2c commit 32e4d81
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions packages/babel-traverse/test/scope.js
Expand Up @@ -782,12 +782,11 @@ describe("scope", () => {
expect(switchStatement.scope.hasOwnBinding("foo")).toBe(false);
});
it("in while statement", () => {
const whileStatement = getPath("while (0) { var foo; }").get("body.0");

const whileStatement = getPath("while (0) \n var foo;").get("body.0");
expect(whileStatement.scope.hasOwnBinding("foo")).toBe(false);
});
it("in do-while statement", () => {
const doWhileStatement = getPath("do { var foo; } while (0)").get(
const doWhileStatement = getPath("do \n var foo \n while(0);").get(
"body.0",
);
expect(doWhileStatement.scope.hasOwnBinding("foo")).toBe(false);
Expand Down Expand Up @@ -869,19 +868,5 @@ describe("scope", () => {
expect(switchStatement.scope.hasOwnBinding("foo")).toBe(true);
});
});
//todo: decide whether these statements should be scopeable and blockParent
describe("let declarations should not be registered", () => {
it("in while statement", () => {
const whileStatement = getPath("while (0) { let foo; }").get("body.0");

expect(whileStatement.scope.hasOwnBinding("foo")).toBe(false);
});
it("in do-while statement", () => {
const doWhileStatement = getPath("do { let foo; } while (0)").get(
"body.0",
);
expect(doWhileStatement.scope.hasOwnBinding("foo")).toBe(false);
});
});
});
});

0 comments on commit 32e4d81

Please sign in to comment.