Skip to content

Commit

Permalink
test262: try to replace all assert.throws
Browse files Browse the repository at this point in the history
test262: 13.27% (+1.42) | πŸ§ͺ 50005 | 🀠 6636 (+710) | ❌ 1751 (+71) | πŸ’€ 14011 (-1643) | πŸ—οΈ 2534 (+56) | πŸ’₯ 2550 (+1247) | ⏰ 2 | πŸ“ 22521 (-441)
  • Loading branch information
CanadaHonk committed May 1, 2024
1 parent f01558f commit fff2457
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test262/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ const run = ({ file, contents, attrs }) => {
// remove actual string concats from some error messages
.replace(/\. Actual: ' \+ .*\);/g, _ => `');`)
// replace some (avoid false pos) assert.throws with inline try
.replace(/assert\.throws\(ReferenceError, function\(\) {([\w\W]+?)}\);/g, (_, body) => `{ let _thrown = false;\ntry {${body}\n_thrown = true;\n} catch {}\nif (_thrown) throw new Test262Error('Expected a ReferenceError to be thrown but no exception was at all'); }\n`);
// .replace(/assert\.throws\(ReferenceError, function\(\) {([\w\W]+?)}\);/g, (_, body) => `{ let _thrown = false;\ntry {${body}\n_thrown = true;\n} catch {}\nif (_thrown) throw new Test262Error('Expected a ReferenceError to be thrown but no exception was at all'); }\n`);
.replace(/assert\.throws\(.*?Error, function\(\) {([\w\W]+?)}\);/g, (_, body) => `{ let _thrown = false;\ntry {${body}\n_thrown = true;\n} catch {}\nif (_thrown) throw new Test262Error('Expected an Error to be thrown but no exception was at all'); }\n`);

// fs.writeFileSync('r.js', toRun);

Expand Down

0 comments on commit fff2457

Please sign in to comment.