Skip to content

Commit

Permalink
Refactor test cases for minify simplily. (#799)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvesteraswin authored and boopathi committed Feb 15, 2018
1 parent 5f3ce6a commit 6546ad1
Show file tree
Hide file tree
Showing 233 changed files with 1,321 additions and 2,228 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const a = () => {};
const b = () => {return;};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const a = () => {};
const b = () => {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const a = () => {return (3, 4);};
const b = () => {return 3;};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const a = () => (3, 4);
const b = () => 3;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const f = () => a;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const f = () => a;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function foo() {
if(window.self != window.top) {
if(__DEV__) {
console.log('lol', name);
}
return;
}
lol();
try { lol() } catch (e) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function foo() {
if (window.self != window.top) return void (__DEV__ && console.log('lol', name));
lol();

try {
lol();
} catch (e) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
for (var x = 0; x < 10; x++) {
console.log(x);
console.log(x);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for (var x = 0; x < 10; x++) console.log(x), console.log(x);
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function foo() {
if (a) {
if (a.b) {
if(a.b.c) {
if(a.b.c()){
return;
}
}
}
}
for (; true;) wat();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function foo() {
if (!(a && a.b && a.b.c && a.b.c())) for (; true;) wat();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function f1() { return a == b ? true : x; }
function f2() { return a == b ? false : x; }
function f3() { return a < b ? !0 : x; }
function f4() { return a < b ? !1 : x; }
function f5() { return c ? !0 : x; }
function f6() { return c ? false : x; }
function f7() { return !c ? true : x; }
function f8() { return !c ? !1 : x; }
function g1() { return a == b ? x : true; }
function g2() { return a == b ? x : false; }
function g3() { return a < b ? x : !0; }
function g4() { return a < b ? x : !1; }
function g5() { return c ? x : true; }
function g6() { return c ? x : !1; }
function g7() { return !c ? x : !0; }
function g8() { return !c ? x : false; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
function f1() {
return !(a != b) || x;
}
function f2() {
return a != b && x;
}
function f3() {
return !!(a < b) || x;
}
function f4() {
return !(a < b) && x;
}
function f5() {
return !!c || x;
}
function f6() {
return !c && x;
}
function f7() {
return !c || x;
}
function f8() {
return !!c && x;
}
function g1() {
return a != b || x;
}
function g2() {
return !(a != b) && x;
}
function g3() {
return !(a < b) || x;
}
function g4() {
return !!(a < b) && x;
}
function g5() {
return !c || x;
}
function g6() {
return !!c && x;
}
function g7() {
return !!c || x;
}
function g8() {
return !c && x;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function h1() { return a && b ? (foo(), true) : false }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function h1() {
return !!(a && b) && (foo(), true);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if (!foo && foo !== bar) {
wow();
such();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!foo && foo !== bar && (wow(), such());
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x();
if (!foo.bar) foo.bar = wat;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x(), !foo.bar && (foo.bar = wat);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
do {
foo();
} while (1);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
do foo(); while (1);
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function foo() {
wow();
if (x) {
return;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function foo() {
wow();
x;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function foo(a) {
if (lol) return;
doThings();
doOtherThings();
}
function bar(a) {
if (lol) {
return;
}
try {
doThings();
} catch (e) {
doOtherThings();
}
}
function baz() {
while (wow) if (lol) return;
boo();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function foo(a) {
lol || (doThings(), doOtherThings());
}
function bar(a) {
if (!lol) try {
doThings();
} catch (e) {
doOtherThings();
}
}
function baz() {
for (; wow;) if (lol) return;

boo();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function foo() {
for (i in p) {}
for (; ;) {}
switch(1) {}
try { a } catch(e) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function foo() {
for (i in p);
for (;;);
switch (1) {}
try {
a;
} catch (e) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function foo() {
lol();
return;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function foo() {
lol();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var x = 1, y, z = 2, zx, a;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var y,
zx,
a,
x = 1,
z = 2;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
if (!(!a && b == a && !b && b < a)) for(;;) a();
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
if (a || b != a || b || !(b < a)) for (;;) a();
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!foo ? 'foo' : 'bar';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo ? 'bar' : 'foo';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
if (!(1 !== foo || !bar)) for (;;);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
if (1 === foo && bar) for (;;);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
!x && foo();
if (!(null == r)) for (;;);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

if (!x && foo(), null != r) for (;;);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function foo() {
x = 1;
a();
for (var a in b) wow();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function foo() {
for (var a in x = 1, a(), b) wow();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function x(a, b) {
a = a || b;
return b === a || !a;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function x(a, b) {
return a = a || b, b === a || !a;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function x(a) {
return !!a;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function x(a) {
return !!a;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function foo(a) {
if (a && a.b != null) {
if ((a.c--) === 1) {
return;
}
return a.b;
}
return bar(a);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function foo(a) {
return a && a.b != null ? a.c-- === 1 ? void 0 : a.b : bar(a);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function foo() {
if (a) {
return;
}

return wow;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function foo() {
return a ? void 0 : wow;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function foo() {
a();
function bar() {}
b();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function foo() {
function bar() {}
a(), b();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
for (i = 1; i <= j; i++) {
foo();
if (bar) break;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for (i = 1; i <= j && (foo(), !bar); i++);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
for (i = 1; i <= j; i++) {
if (bar) {
break;
} else {
wat();
if (x) throw 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for (i = 1; i <= j && !bar; i++) if (wat(), x) throw 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
for (i = 1; i <= j; i++) {
if (bar) {
wat();
if (x) throw 1;
} else {
break;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for (i = 1; i <= j && !!bar; i++) if (wat(), x) throw 1;
Loading

0 comments on commit 6546ad1

Please sign in to comment.