* Better tdz tests - Use jest's expect.toThrow/expect.not.toThrow - Add input/output tests * Fix basic tdz (a = 2; let a) Fixes #6848 * Make _guessExecutionStatusRelativeTo more robust * Add tests * Return less "unkown" execution status * "function" execution status does not exist * Fix recursive functions * Update helper version * "finally" blocks are always executed * Typo
30 lines
450 B
JavaScript
30 lines
450 B
JavaScript
// "random" :)
|
|
let random = (i => {
|
|
const vals = [0, 0, 1, 1];
|
|
return () => vals[i++];
|
|
})(0);
|
|
|
|
expect(() => {
|
|
function f() { x }
|
|
random() && f();
|
|
let x;
|
|
}).not.toThrow();
|
|
|
|
expect(() => {
|
|
function f() { x }
|
|
random() || f();
|
|
let x;
|
|
}).toThrow(ReferenceError);
|
|
|
|
expect(() => {
|
|
function f() { x }
|
|
random() && f();
|
|
let x;
|
|
}).toThrow(ReferenceError);
|
|
|
|
expect(() => {
|
|
function f() { x }
|
|
random() || f();
|
|
let x;
|
|
}).not.toThrow();
|