move all plugin tests out of babel-core and into their appropriate folders

This commit is contained in:
Sebastian McKenzie
2015-11-08 23:04:10 -08:00
parent 5f40b53dee
commit 15969a0904
1189 changed files with 365 additions and 65 deletions

View File

@@ -0,0 +1,23 @@
var foo = function () {};
assert.equal(foo.name, "foo");
var obj = { foo: function () {} };
assert.equal(obj.foo.name, "foo");
var obj = { "foo": function () {} };
assert.equal(obj.foo.name, "foo");
var obj = { foo() {} };
assert.equal(obj.foo.name, "foo");
var obj = { "foo"() {} };
assert.equal(obj.foo.name, "foo");
function noop() {}
var obj = { @noop foo() {} };
assert.equal(obj.foo.name, "foo");
var obj = { @noop foo: function () { return "foo"; } };
assert.equal(obj.foo.name, "foo");

View File

@@ -0,0 +1,3 @@
{
"plugins": ["transform-decorators"]
}

View File

@@ -0,0 +1,9 @@
var i = function () {
i = 5;
};
var j = function () {
({ j } = 5);
({ y: j } = 5);
;
};

View File

@@ -0,0 +1,9 @@
var _i = function i() {
_i = 5;
};
var _j = function j() {
({ j: _j } = 5);
({ y: _j } = 5);
;
};

View File

@@ -0,0 +1,3 @@
var g = function () {
doSmth();
};

View File

@@ -0,0 +1,3 @@
var g = function g() {
doSmth();
};

View File

@@ -0,0 +1,5 @@
class Foo {
t(t) {
return t;
}
}

View File

@@ -0,0 +1,13 @@
let Foo = (function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
}
babelHelpers.createClass(Foo, [{
key: "t",
value: function t(_t) {
return _t;
}
}]);
return Foo;
})();

View File

@@ -0,0 +1,9 @@
var obj = {
search: function({search}) {
console.log(search);
}
};
function search({search}) {
console.log(search);
}

View File

@@ -0,0 +1,9 @@
var obj = {
search: function search({ search: _search }) {
console.log(_search);
}
};
function search({ search }) {
console.log(search);
}

View File

@@ -0,0 +1,5 @@
var a = {
eval: function () {
return eval;
}
};

View File

@@ -0,0 +1,5 @@
var a = {
eval: function _eval() {
return eval;
}
};

View File

@@ -0,0 +1,19 @@
export var foo = "yes", foob = "no";
export function whatever() {}
export default function wowzers() {}
var bar = {
foo: function () {
foo;
},
whatever: function () {
whatever;
},
wowzers: function () {
wowzers;
}
};

View File

@@ -0,0 +1,23 @@
export { _whatever as whatever };
export { _wowzers as default };
var _foo = "yes",
foob = "no";
export { _foo as foo, foob };
function _whatever() {}
function _wowzers() {}
var bar = {
foo: function foo() {
_foo;
},
whatever: function whatever() {
_whatever;
},
wowzers: function wowzers() {
_wowzers;
}
};

View File

@@ -0,0 +1,19 @@
function f() {
f;
}
{
let obj = {
f: function () {
f;
}
};
}
(function b() {
var obj = {
b: function () {
b;
}
};
});

View File

@@ -0,0 +1,19 @@
function _f() {
_f;
}
{
let obj = {
f: function f() {
_f;
}
};
}
(function _b() {
var obj = {
b: function b() {
_b;
}
};
});

View File

@@ -0,0 +1,5 @@
var test = {
setInterval: function(fn, ms) {
setInterval(fn, ms);
}
};

View File

@@ -0,0 +1,15 @@
var test = {
setInterval: (function (_setInterval) {
function setInterval(_x, _x2) {
return _setInterval.apply(this, arguments);
}
setInterval.toString = function () {
return _setInterval.toString();
};
return setInterval;
})(function (fn, ms) {
setInterval(fn, ms);
})
};

View File

@@ -0,0 +1,11 @@
import last from "lodash/array/last"
export default class Container {
last(key) {
if (!this.has(key)) {
return;
}
return last(this.tokens.get(key))
}
}

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _last2 = require("lodash/array/last");
var _last3 = babelHelpers.interopRequireDefault(_last2);
let Container = (function () {
function Container() {
babelHelpers.classCallCheck(this, Container);
}
babelHelpers.createClass(Container, [{
key: "last",
value: function last(key) {
if (!this.has(key)) {
return;
}
return (0, _last3.default)(this.tokens.get(key));
}
}]);
return Container;
})();
exports.default = Container;

View File

@@ -0,0 +1,3 @@
{
"plugins": ["external-helpers-2", "transform-es2015-function-name", "transform-es2015-classes", "transform-decorators", "transform-es2015-modules-commonjs"]
}

View File

@@ -0,0 +1,7 @@
import {getForm} from "./store"
export default class Login extends React.Component {
getForm() {
return getForm().toJS()
}
}

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _store = require("./store");
let Login = (function (_React$Component) {
babelHelpers.inherits(Login, _React$Component);
function Login() {
babelHelpers.classCallCheck(this, Login);
return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Login).apply(this, arguments));
}
babelHelpers.createClass(Login, [{
key: "getForm",
value: function getForm() {
return (0, _store.getForm)().toJS();
}
}]);
return Login;
})(React.Component);
exports.default = Login;

View File

@@ -0,0 +1,3 @@
{
"plugins": ["external-helpers-2", "transform-es2015-function-name", "transform-es2015-modules-commonjs", "transform-es2015-classes", "transform-decorators"]
}

View File

@@ -0,0 +1,9 @@
export function foo(bar) {
}
var bar = {
foo: function () {
foo;
}
};

View File

@@ -0,0 +1,8 @@
export { _foo as foo };
function _foo(bar) {}
var bar = {
foo: function foo() {
_foo;
}
};

View File

@@ -0,0 +1,9 @@
import events from "events";
class Template {
events() {
return events;
}
}
console.log(new Template().events());

View File

@@ -0,0 +1,21 @@
"use strict";
var _events2 = require("events");
var _events3 = babelHelpers.interopRequireDefault(_events2);
let Template = (function () {
function Template() {
babelHelpers.classCallCheck(this, Template);
}
babelHelpers.createClass(Template, [{
key: "events",
value: function events() {
return _events3.default;
}
}]);
return Template;
})();
console.log(new Template().events());

View File

@@ -0,0 +1,3 @@
{
"plugins": ["external-helpers-2", "transform-es2015-function-name", "transform-es2015-modules-commonjs", "transform-es2015-classes", "transform-decorators"]
}

View File

@@ -0,0 +1,15 @@
var obj = {
f: function () {
(function f() {
console.log(f);
})();
},
h: function () {
console.log(h);
},
m: function () {
doSmth();
}
};

View File

@@ -0,0 +1,25 @@
var obj = {
f: function f() {
(function f() {
console.log(f);
})();
},
h: (function (_h) {
function h() {
return _h.apply(this, arguments);
}
h.toString = function () {
return _h.toString();
};
return h;
})(function () {
console.log(h);
}),
m: function m() {
doSmth();
}
};

View File

@@ -0,0 +1,3 @@
{
"plugins": ["external-helpers-2", "transform-es2015-function-name", "transform-es2015-classes", "transform-decorators"]
}

View File

@@ -0,0 +1,13 @@
var f = function () {
var f = 2;
};
var g = function (g) {
g;
};
var obj = {
f: function (f) {
f;
}
};

View File

@@ -0,0 +1,13 @@
var f = function f() {
var f = 2;
};
var g = function g(_g) {
_g;
};
var obj = {
f: function f(_f) {
_f;
}
};

View File

@@ -0,0 +1,5 @@
var f = function () {
console.log(f, g);
};
f = null;

View File

@@ -0,0 +1,5 @@
var _f = function f() {
console.log(_f, g);
};
_f = null;

View File

@@ -0,0 +1,20 @@
var Utils = {
get: function() {}
};
var { get } = Utils;
var bar = {
get: function(arg) {
get(arg, "baz");
}
};
var f = function ({ foo = "bar" }) {
var obj = {
// same name as parameter
foo: function () {
foo;
}
};
};

View File

@@ -0,0 +1,20 @@
var Utils = {
get: function get() {}
};
var { get: _get } = Utils;
var bar = {
get: function get(arg) {
_get(arg, "baz");
}
};
var f = function f({ foo: _foo = "bar" }) {
var obj = {
// same name as parameter
foo: function foo() {
_foo;
}
};
};

View File

@@ -0,0 +1 @@
require("babel-helper-plugin-test-runner")(__dirname);