Skip to content

Commit

Permalink
added early return tests
Browse files Browse the repository at this point in the history
  • Loading branch information
keyz committed Apr 18, 2016
1 parent c8ac59c commit d90df35
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Interp/__tests__/ExpressionInterp-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,23 @@ describe('Interp', () => {
})());
});

it('should support early return statements', () => {
expect(interpExp(`(() => {
const fact = (x) => (x < 2 ? 1 : x * fact(x - 1));
return fact(5);
const foo = 12;
const bar = 140;
return foo + bar;
})()`)).toBe((() => {
const fact = (x) => (x < 2 ? 1 : x * fact(x - 1));
return fact(5);
const foo = 12; // eslint-disable-line no-unreachable
const bar = 140; // eslint-disable-line no-unreachable
return foo + bar; // eslint-disable-line no-unreachable
})());
});


// it('IfStatement', () => {
// expect(interpExp(`(() => {
// const foo = 12;
Expand Down

0 comments on commit d90df35

Please sign in to comment.