Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions src/__tests__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,15 @@ test('parseError for template literals with expressions', () => {
)
})

/* Skip the test for now
test('Simple arrow function infinite recursion represents CallExpression well', () => {
return expectParsedError('(x => x(x)(x))(x => x(x)(x));').toMatchInlineSnapshot(
`"Line 1: RangeError: Maximum call stack size exceeded"`
return expectParsedError('(x => x(x)(x))(x => x(x)(x));').toContain(
`RangeError: Maximum call stack size exceeded`
)
}, 30000)
*/

test('Simple function infinite recursion represents CallExpression well', () => {
return expectParsedError('function f(x) {return x(x)(x);} f(f);').toMatchInlineSnapshot(
`"RangeError: Maximum call stack size exceeded"`
return expectParsedError('function f(x) {return x(x)(x);} f(f);').toContain(
`RangeError: Maximum call stack size exceeded`
)
}, 30000)

Expand Down Expand Up @@ -177,9 +175,7 @@ test('Arrow function infinite recursion with list args represents CallExpression
f(list(1, 2));
`,
{ chapter: Chapter.SOURCE_2 }
).toMatchInlineSnapshot(
`"Line 2: The function (anonymous) has encountered an infinite loop. It has no base case."`
)
).toContain(`RangeError: Maximum call stack size exceeded`)
}, 30000)

test('Function infinite recursion with list args represents CallExpression well', () => {
Expand All @@ -195,18 +191,14 @@ test('Arrow function infinite recursion with different args represents CallExpre
return expectParsedError(stripIndent`
const f = i => f(i+1) - 1;
f(0);
`).toMatchInlineSnapshot(
`"Line 2: The function (anonymous) has encountered an infinite loop. It has no base case."`
)
`).toContain(`RangeError: Maximum call stack size exceeded`)
}, 30000)

test('Function infinite recursion with different args represents CallExpression well', () => {
return expectParsedError(stripIndent`
function f(i) { return f(i+1) - 1; }
f(0);
`).toMatchInlineSnapshot(
`"Line 2: The function f has encountered an infinite loop. It has no base case."`
)
`).toContain(`RangeError: Maximum call stack size exceeded`)
}, 30000)

test('Functions passed into non-source functions remain equal', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/tailcall-return.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test('Check that stack is at most 10k in size', () => {
}
}
f(10000);
`).toMatchInlineSnapshot(`"Line 5: RangeError: Maximum call stack size exceeded"`)
`).toContain(`Line 5: RangeError: Maximum call stack size exceeded`)
}, 10000)

test('Simple tail call returns work', () => {
Expand Down
81 changes: 0 additions & 81 deletions src/infiniteLoops/__tests__/errors.ts

This file was deleted.

170 changes: 0 additions & 170 deletions src/infiniteLoops/__tests__/instrument.ts

This file was deleted.

Loading
Loading