Skip to content

Commit

Permalink
Merge pull request #718 from babel/fixtures-tests-01
Browse files Browse the repository at this point in the history
Fixtures tests - part 2
  • Loading branch information
boopathi authored Nov 9, 2017
2 parents f8b65f2 + b65e927 commit 9d4fbfa
Show file tree
Hide file tree
Showing 134 changed files with 1,296 additions and 1,600 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ coverage
.test_gen_*
lib/
*.log
*~
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// constants first
a === -1;

x * 100;
x + 100;
x - 100;
x / 100;
x > 100;
x === void 0;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// constants first
-1 === a;

100 * x;
x + 100;
x - 100;
x / 100;
100 < x;
void 0 === x;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// pures first

a === null;

a === {};

function foo() {
if (foo !== null) {
var bar;
bar = baz;
}
x();
return x;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// pures first

null === a;

({}) === a;

function foo() {
if (null !== foo) {
var bar;
bar = baz;
}
x();
return x;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// values first
a === 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// values first
1 === a;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x === null ? undefined : x === undefined ? undefined : x ? foo(x) : wat();
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null === x ? undefined : x === undefined ? undefined : x ? foo(x) : wat();

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const runner = require("test-runner");
runner(__dirname);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!x && foo();
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x || foo();
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a && void alert("Side effect");
alert(func() || true);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a && void alert("Side effect");
alert(func() || true);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alert(0 && new Foo());
if (0 && something()) for (;;);
alert(false && new Foo());
alert(undefined && new Foo());
alert(null && new Foo());
alert("" && new Foo());
alert(new Foo() || false);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alert(0);
if (0) for (;;);
alert(false);
alert(undefined);
alert(null);
alert("");
alert(new Foo() || false);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alert(1 && new Bar());
alert(true && new Bar());
alert("hello" && new Bar());
alert(!false && new Bar());
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alert(new Bar());
alert(new Bar());
alert(new Bar());
alert(new Bar());

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const runner = require("test-runner");
runner(__dirname);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Infinity = 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Infinity = 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
({ Infinity } = 1);
[Infinity] = foo;
[...Infinity] = foo;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
({ Infinity } = 1);
[Infinity] = foo;
[...Infinity] = foo;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function a(Infinity) {}
function b(...Infinity) {}
function c({ Infinity }) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function a(Infinity) {}
function b(...Infinity) {}
function c({ Infinity }) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var x = { Infinity: 0 };
x.Infinity;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var x = { Infinity: 0 };
x.Infinity;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Infinity;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 / 0;
2 changes: 2 additions & 0 deletions packages/babel-plugin-minify-infinity/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const runner = require("test-runner");
runner(__dirname);
48 changes: 0 additions & 48 deletions packages/babel-plugin-minify-infinity/__tests__/infinity-test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function foo() {
var xxx = 1;
if (xxx) {
console.log(xxx);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function foo() {
var a = 1;
if (a) {
console.log(a);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class A {}
class B {}
new A();
new B();
function a() {
class A {}
class B {}
new A();
new B();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class A {}
class B {}
new A();
new B();
function a() {
class a {}
class b {}
new a();
new b();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function foo() {
function bar(baz) {
return function() {
bam();
};
}
function bam() {}
}
Loading

0 comments on commit 9d4fbfa

Please sign in to comment.