Skip to content

Commit 55ce143

Browse files
committed
Add test case
1 parent be6bdff commit 55ce143

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

test/cases/parsing/issue-7335/a.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 9;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import x from "./a";
2+
3+
const sum1 = (x, y, total = x + y) => total;
4+
const id1 = (a = x) => a;
5+
6+
function sum2(x, y, total = x + y) { return total; }
7+
function id2(a = x) { return a; }
8+
9+
const sum3 = function(x, y, total = x + y) { return total; }
10+
const id3 = function(a = x) { return a; }
11+
12+
it("should shadow imported bindings", () => {
13+
// Arrow functions
14+
expect(sum1(2, 3)).toBe(5);
15+
expect(id1(1)).toBe(1);
16+
expect(id1()).toBe(9);
17+
18+
// Function declarations
19+
expect(sum2(2, 3)).toBe(5);
20+
expect(id2(1)).toBe(1);
21+
expect(id2()).toBe(9);
22+
23+
// Function expressions
24+
expect(sum3(2, 3)).toBe(5);
25+
expect(id3(1)).toBe(1);
26+
expect(id3()).toBe(9);
27+
});

0 commit comments

Comments
 (0)