Skip to content

Commit

Permalink
add additional tests and a TODO comment for a previously/currently fa…
Browse files Browse the repository at this point in the history
…iling test case
  • Loading branch information
kzc committed Jun 6, 2021
1 parent c71d031 commit f7a7f5c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/form/samples/tdz-common/_expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,14 @@ L2; // TDZ for L2
L3 = 20; // TDZ for L3
let L2, L3; // keep L2, L3
L3 = 30; // keep

// Note that typical var/const/let use is still optimized
(function() {
console.log(A ? "A" : "!A");
var A = 1;
console.log("A" );
console.log("B");
console.log("B" );
console.log("C" );
console.log("D" );
})();
14 changes: 14 additions & 0 deletions test/form/samples/tdz-common/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@ let L1, L2, L3, L4; // keep L2, L3
var V3; // drop
L3 = 30; // keep
L4 = 40; // drop

// Note that typical var/const/let use is still optimized
(function() {
console.log(A ? "A" : "!A");
var A = 1, B = 2;
const C = 3;
let D = 4;
console.log(A ? "A" : "!A");
if (B) console.log("B");
else console.log("!B");
console.log(B ? "B" : "!B");
console.log(C ? "C" : "!C");
console.log(D ? "D" : "!D");
})();
8 changes: 8 additions & 0 deletions test/function/samples/use-var-before-decl/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,12 @@ log(c ? "PASS5" : "FAIL5");
})();
*/

/* TODO: previously existing bug still fails, but in a different way
log(function() {
if (x) return "HELLO";
var x = 1;
return "WORLD";
}());
*/

assert.strictEqual(results.join(" "), "PASS1 PASS2 PASS3 PASS4 PASS5");

0 comments on commit f7a7f5c

Please sign in to comment.