-
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #718 from babel/fixtures-tests-01
Fixtures tests - part 2
- Loading branch information
Showing
134 changed files
with
1,296 additions
and
1,600 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ coverage | |
.test_gen_* | ||
lib/ | ||
*.log | ||
*~ |
9 changes: 9 additions & 0 deletions
9
...l-plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-constants-first/actual.js
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,9 @@ | ||
// constants first | ||
a === -1; | ||
|
||
x * 100; | ||
x + 100; | ||
x - 100; | ||
x / 100; | ||
x > 100; | ||
x === void 0; |
9 changes: 9 additions & 0 deletions
9
...plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-constants-first/expected.js
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,9 @@ | ||
// constants first | ||
-1 === a; | ||
|
||
100 * x; | ||
x + 100; | ||
x - 100; | ||
x / 100; | ||
100 < x; | ||
void 0 === x; |
14 changes: 14 additions & 0 deletions
14
...babel-plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-pures-first/actual.js
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,14 @@ | ||
// pures first | ||
|
||
a === null; | ||
|
||
a === {}; | ||
|
||
function foo() { | ||
if (foo !== null) { | ||
var bar; | ||
bar = baz; | ||
} | ||
x(); | ||
return x; | ||
} |
14 changes: 14 additions & 0 deletions
14
...bel-plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-pures-first/expected.js
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,14 @@ | ||
// pures first | ||
|
||
null === a; | ||
|
||
({}) === a; | ||
|
||
function foo() { | ||
if (null !== foo) { | ||
var bar; | ||
bar = baz; | ||
} | ||
x(); | ||
return x; | ||
} |
2 changes: 2 additions & 0 deletions
2
...abel-plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-values-first/actual.js
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,2 @@ | ||
// values first | ||
a === 1; |
2 changes: 2 additions & 0 deletions
2
...el-plugin-minify-flip-comparisons/__tests__/fixtures/binary-expr-values-first/expected.js
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,2 @@ | ||
// values first | ||
1 === a; |
1 change: 1 addition & 0 deletions
1
...-plugin-minify-flip-comparisons/__tests__/fixtures/conditionals-same-consequent/actual.js
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 @@ | ||
x === null ? undefined : x === undefined ? undefined : x ? foo(x) : wat(); |
1 change: 1 addition & 0 deletions
1
...lugin-minify-flip-comparisons/__tests__/fixtures/conditionals-same-consequent/expected.js
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 @@ | ||
null === x ? undefined : x === undefined ? undefined : x ? foo(x) : wat(); |
87 changes: 0 additions & 87 deletions
87
packages/babel-plugin-minify-flip-comparisons/__tests__/flip-comparisons-test.js
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
packages/babel-plugin-minify-flip-comparisons/__tests__/index.js
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,2 @@ | ||
const runner = require("test-runner"); | ||
runner(__dirname); |
1 change: 1 addition & 0 deletions
1
...es/babel-plugin-minify-guarded-expressions/__tests__/fixtures/flip-logical-expr/actual.js
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 @@ | ||
!x && foo(); |
1 change: 1 addition & 0 deletions
1
.../babel-plugin-minify-guarded-expressions/__tests__/fixtures/flip-logical-expr/expected.js
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 @@ | ||
x || foo(); |
2 changes: 2 additions & 0 deletions
2
...bel-plugin-minify-guarded-expressions/__tests__/fixtures/reachable-impure-stmts/actual.js
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,2 @@ | ||
a && void alert("Side effect"); | ||
alert(func() || true); |
2 changes: 2 additions & 0 deletions
2
...l-plugin-minify-guarded-expressions/__tests__/fixtures/reachable-impure-stmts/expected.js
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,2 @@ | ||
a && void alert("Side effect"); | ||
alert(func() || true); |
7 changes: 7 additions & 0 deletions
7
.../babel-plugin-minify-guarded-expressions/__tests__/fixtures/simplify-falsy-expr/actual.js
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,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); |
7 changes: 7 additions & 0 deletions
7
...abel-plugin-minify-guarded-expressions/__tests__/fixtures/simplify-falsy-expr/expected.js
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,7 @@ | ||
alert(0); | ||
if (0) for (;;); | ||
alert(false); | ||
alert(undefined); | ||
alert(null); | ||
alert(""); | ||
alert(new Foo() || false); |
4 changes: 4 additions & 0 deletions
4
...babel-plugin-minify-guarded-expressions/__tests__/fixtures/simplify-truthy-expr/actual.js
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,4 @@ | ||
alert(1 && new Bar()); | ||
alert(true && new Bar()); | ||
alert("hello" && new Bar()); | ||
alert(!false && new Bar()); |
4 changes: 4 additions & 0 deletions
4
...bel-plugin-minify-guarded-expressions/__tests__/fixtures/simplify-truthy-expr/expected.js
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,4 @@ | ||
alert(new Bar()); | ||
alert(new Bar()); | ||
alert(new Bar()); | ||
alert(new Bar()); |
61 changes: 0 additions & 61 deletions
61
packages/babel-plugin-minify-guarded-expressions/__tests__/guarded-expressions-test.js
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
packages/babel-plugin-minify-guarded-expressions/__tests__/index.js
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,2 @@ | ||
const runner = require("test-runner"); | ||
runner(__dirname); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-minify-infinity/__tests__/fixtures/assignment-expr/actual.js
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 @@ | ||
Infinity = 1; |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-minify-infinity/__tests__/fixtures/assignment-expr/expected.js
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 @@ | ||
Infinity = 1; |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-minify-infinity/__tests__/fixtures/destructure/actual.js
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,3 @@ | ||
({ Infinity } = 1); | ||
[Infinity] = foo; | ||
[...Infinity] = foo; |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-minify-infinity/__tests__/fixtures/destructure/expected.js
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,3 @@ | ||
({ Infinity } = 1); | ||
[Infinity] = foo; | ||
[...Infinity] = foo; |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-minify-infinity/__tests__/fixtures/fn-param/actual.js
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,3 @@ | ||
function a(Infinity) {} | ||
function b(...Infinity) {} | ||
function c({ Infinity }) {} |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-minify-infinity/__tests__/fixtures/fn-param/expected.js
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,3 @@ | ||
function a(Infinity) {} | ||
function b(...Infinity) {} | ||
function c({ Infinity }) {} |
2 changes: 2 additions & 0 deletions
2
packages/babel-plugin-minify-infinity/__tests__/fixtures/property/actual.js
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,2 @@ | ||
var x = { Infinity: 0 }; | ||
x.Infinity; |
2 changes: 2 additions & 0 deletions
2
packages/babel-plugin-minify-infinity/__tests__/fixtures/property/expected.js
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,2 @@ | ||
var x = { Infinity: 0 }; | ||
x.Infinity; |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-minify-infinity/__tests__/fixtures/to-1-over-0/actual.js
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 @@ | ||
Infinity; |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-minify-infinity/__tests__/fixtures/to-1-over-0/expected.js
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 @@ | ||
1 / 0; |
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,2 @@ | ||
const runner = require("test-runner"); | ||
runner(__dirname); |
48 changes: 0 additions & 48 deletions
48
packages/babel-plugin-minify-infinity/__tests__/infinity-test.js
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/basic/actual.js
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,6 @@ | ||
function foo() { | ||
var xxx = 1; | ||
if (xxx) { | ||
console.log(xxx); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/basic/expected.js
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,6 @@ | ||
function foo() { | ||
var a = 1; | ||
if (a) { | ||
console.log(a); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/classes/actual.js
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,10 @@ | ||
class A {} | ||
class B {} | ||
new A(); | ||
new B(); | ||
function a() { | ||
class A {} | ||
class B {} | ||
new A(); | ||
new B(); | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/classes/expected.js
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,10 @@ | ||
class A {} | ||
class B {} | ||
new A(); | ||
new B(); | ||
function a() { | ||
class a {} | ||
class b {} | ||
new a(); | ||
new b(); | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/babel-plugin-minify-mangle-names/__tests__/fixtures/closures-2/actual.js
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,8 @@ | ||
function foo() { | ||
function bar(baz) { | ||
return function() { | ||
bam(); | ||
}; | ||
} | ||
function bam() {} | ||
} |
Oops, something went wrong.