forked from babel/babel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(broken tests) test for scoping inside pipelines
- Loading branch information
1 parent
5d74045
commit 155e217
Showing
4 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...-plugin-proposal-pipeline-operator/test/fixtures/fsharp/arrow-functions-parenless/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const y = 2; | ||
const f = (x) => x | ||
|> (y) => y + 1 | ||
|> (z) => z * y | ||
|
||
const g = (x) => x | ||
|> (y => { return ( | ||
y + 1 | ||
|> (z) => z * y); | ||
} | ||
) | ||
|
||
// bug: scope for the pipelinebody (???) does not consider the third y as a reference to the first | ||
|
||
const h = (x) => x | ||
|> (y => ( | ||
y + 1 | ||
|> (z) => z * y) | ||
) | ||
|
||
const i = (x) => x | ||
|> (y) => ( | ||
y + 1 | ||
|> (z) => z * y | ||
) | ||
|
||
expect(f(1)).toBe(4); | ||
expect(g(1)).toBe(2); | ||
expect(h(1)).toBe(2); | ||
// expect(i(1)).toBe(2); |
20 changes: 20 additions & 0 deletions
20
...plugin-proposal-pipeline-operator/test/fixtures/minimal/arrow-functions-parenless/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const y = 2; | ||
const f = (x) => x | ||
|> (y => y + 1) | ||
|> (z => z * y) | ||
|
||
const g = (x) => x | ||
|> (y => | ||
y + 1 | ||
|> (z => z * y) | ||
) | ||
|
||
const h = (x) => x | ||
|> (y => ( | ||
y + 1 | ||
|> (z => z * y) | ||
)) | ||
|
||
expect(f(1)).toBe(4); | ||
expect(g(1)).toBe(2); | ||
expect(h(1)).toBe(2); |
20 changes: 20 additions & 0 deletions
20
...lugin-proposal-pipeline-operator/test/fixtures/minimal/arrow-functions-parenless/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const y = 2; | ||
const f = (x) => x | ||
|> (y => y + 1) | ||
|> (z => z * y) | ||
|
||
const g = (x) => x | ||
|> (y => | ||
y + 1 | ||
|> (z => z * y) | ||
) | ||
|
||
const h = (x) => x | ||
|> (y => ( | ||
y + 1 | ||
|> (z => z * y) | ||
)) | ||
|
||
expect(f(1)).toBe(4); | ||
expect(g(1)).toBe(2); | ||
expect(h(1)).toBe(2); |
23 changes: 23 additions & 0 deletions
23
...ugin-proposal-pipeline-operator/test/fixtures/minimal/arrow-functions-parenless/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const y = 2; | ||
|
||
const f = x => { | ||
var _z, _y; | ||
|
||
return _z = (_y = x, _y + 1), _z * y; | ||
}; | ||
|
||
const g = x => { | ||
var _y2, _z2; | ||
|
||
return _y2 = x, (_z2 = _y2 + 1, _z2 * _y2); | ||
}; | ||
|
||
const h = x => { | ||
var _y3, _z3; | ||
|
||
return _y3 = x, (_z3 = _y3 + 1, _z3 * _y3); | ||
}; | ||
|
||
expect(f(1)).toBe(4); | ||
expect(g(1)).toBe(2); | ||
expect(h(1)).toBe(2); |