-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate message eval tests from Python to JS
Migrate the eval tests in the `test/message` folder from Python to JS.
- Loading branch information
1 parent
81f7c76
commit 965ba46
Showing
7 changed files
with
201 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
[eval] | ||
[eval]:1 | ||
with(this){__filename} | ||
^^^^ | ||
|
||
SyntaxError: Strict mode code may not include a with statement | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Node.js * | ||
42 | ||
42 | ||
[eval]:1 | ||
throw new Error("hello") | ||
^ | ||
|
||
Error: hello | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Node.js * | ||
[eval]:1 | ||
throw new Error("hello") | ||
^ | ||
|
||
Error: hello | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Node.js * | ||
100 | ||
[eval]:1 | ||
var x = 100; y = x; | ||
^ | ||
|
||
ReferenceError: y is not defined | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Node.js * | ||
|
||
[eval]:1 | ||
var ______________________________________________; throw 10 | ||
^ | ||
10 | ||
(Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
|
||
Node.js * | ||
|
||
[eval]:1 | ||
var ______________________________________________; throw 10 | ||
^ | ||
10 | ||
(Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
|
||
Node.js * | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
[stdin] | ||
[stdin]:1 | ||
with(this){__filename} | ||
^^^^ | ||
|
||
SyntaxError: Strict mode code may not include a with statement | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Node.js * | ||
42 | ||
42 | ||
[stdin]:1 | ||
throw new Error("hello") | ||
^ | ||
|
||
Error: hello | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Node.js * | ||
[stdin]:1 | ||
throw new Error("hello") | ||
^ | ||
|
||
Error: hello | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Node.js * | ||
100 | ||
[stdin]:1 | ||
let x = 100; y = x; | ||
^ | ||
|
||
ReferenceError: y is not defined | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Node.js * | ||
|
||
[stdin]:1 | ||
let ______________________________________________; throw 10 | ||
^ | ||
10 | ||
(Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
|
||
Node.js * | ||
|
||
[stdin]:1 | ||
let ______________________________________________; throw 10 | ||
^ | ||
10 | ||
(Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
|
||
Node.js * | ||
done |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import '../common/index.mjs'; | ||
import * as fixtures from '../common/fixtures.mjs'; | ||
import * as snapshot from '../common/assertSnapshot.js'; | ||
import { describe, it } from 'node:test'; | ||
|
||
describe('eval output', { concurrency: true }, () => { | ||
function normalize(str) { | ||
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '') | ||
.replaceAll(/\d+:\d+/g, '*:*'); | ||
} | ||
|
||
const defaultTransform = snapshot.transform( | ||
removeStackTraces, | ||
normalize, | ||
snapshot.replaceWindowsLineEndings, | ||
snapshot.replaceWindowsPaths, | ||
snapshot.replaceNodeVersion | ||
); | ||
|
||
function removeStackTraces(output) { | ||
return output.replaceAll(/^ *at .+$/gm, ''); | ||
} | ||
|
||
const tests = [ | ||
{ name: 'eval/eval_messages.js' }, | ||
{ name: 'eval/stdin_messages.js' }, | ||
]; | ||
|
||
for (const { name } of tests) { | ||
it(name, async () => { | ||
await snapshot.spawnAndAssert(fixtures.path(name), defaultTransform); | ||
}); | ||
} | ||
}); |