Skip to content

Commit 9c2e795

Browse files
authored
Remove infinite loop detector (#1813)
* Remove infinite loop detector * Remove now unneeded code * Update test snapshots * Use substring match to fix nondeterministic tests
1 parent 02bf939 commit 9c2e795

File tree

14 files changed

+9
-2601
lines changed

14 files changed

+9
-2601
lines changed

src/__tests__/index.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,15 @@ test('parseError for template literals with expressions', () => {
104104
)
105105
})
106106

107-
/* Skip the test for now
108107
test('Simple arrow function infinite recursion represents CallExpression well', () => {
109-
return expectParsedError('(x => x(x)(x))(x => x(x)(x));').toMatchInlineSnapshot(
110-
`"Line 1: RangeError: Maximum call stack size exceeded"`
108+
return expectParsedError('(x => x(x)(x))(x => x(x)(x));').toContain(
109+
`RangeError: Maximum call stack size exceeded`
111110
)
112111
}, 30000)
113-
*/
114112

115113
test('Simple function infinite recursion represents CallExpression well', () => {
116-
return expectParsedError('function f(x) {return x(x)(x);} f(f);').toMatchInlineSnapshot(
117-
`"RangeError: Maximum call stack size exceeded"`
114+
return expectParsedError('function f(x) {return x(x)(x);} f(f);').toContain(
115+
`RangeError: Maximum call stack size exceeded`
118116
)
119117
}, 30000)
120118

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

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

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

212204
test('Functions passed into non-source functions remain equal', () => {

src/__tests__/tailcall-return.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('Check that stack is at most 10k in size', () => {
1111
}
1212
}
1313
f(10000);
14-
`).toMatchInlineSnapshot(`"Line 5: RangeError: Maximum call stack size exceeded"`)
14+
`).toContain(`Line 5: RangeError: Maximum call stack size exceeded`)
1515
}, 10000)
1616

1717
test('Simple tail call returns work', () => {

src/infiniteLoops/__tests__/errors.ts

Lines changed: 0 additions & 81 deletions
This file was deleted.

src/infiniteLoops/__tests__/instrument.ts

Lines changed: 0 additions & 170 deletions
This file was deleted.

0 commit comments

Comments
 (0)