Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ooflorent committed May 25, 2018
1 parent be6bdff commit 55ce143
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/cases/parsing/issue-7335/a.js
@@ -0,0 +1 @@
export default 9;
27 changes: 27 additions & 0 deletions test/cases/parsing/issue-7335/index.js
@@ -0,0 +1,27 @@
import x from "./a";

const sum1 = (x, y, total = x + y) => total;
const id1 = (a = x) => a;

function sum2(x, y, total = x + y) { return total; }
function id2(a = x) { return a; }

const sum3 = function(x, y, total = x + y) { return total; }
const id3 = function(a = x) { return a; }

it("should shadow imported bindings", () => {
// Arrow functions
expect(sum1(2, 3)).toBe(5);
expect(id1(1)).toBe(1);
expect(id1()).toBe(9);

// Function declarations
expect(sum2(2, 3)).toBe(5);
expect(id2(1)).toBe(1);
expect(id2()).toBe(9);

// Function expressions
expect(sum3(2, 3)).toBe(5);
expect(id3(1)).toBe(1);
expect(id3()).toBe(9);
});

0 comments on commit 55ce143

Please sign in to comment.