Skip to content

Commit

Permalink
(broken tests) test for scoping inside pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoarrais committed Mar 27, 2019
1 parent 5d74045 commit 155e217
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
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);
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);
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);
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);

0 comments on commit 155e217

Please sign in to comment.