mirror of
https://github.com/swc-project/swc.git
synced 2024-11-23 09:38:16 +03:00
test(es): Organize tests (#4129)
This commit is contained in:
parent
cdf868f7f0
commit
ede6e027c2
@ -185,6 +185,8 @@ fn test_file_with_opts(entry: &Path, opts: &Options, expected_stdout: &str) -> R
|
||||
.process_js_file(fm, handler, opts)
|
||||
.context("failed to process file")?;
|
||||
|
||||
println!("Code:\n{}", res.code);
|
||||
|
||||
let actual_stdout = stdout_of(&res.code)?;
|
||||
|
||||
assert_eq!(expected_stdout, actual_stdout);
|
||||
|
@ -1 +0,0 @@
|
||||
"\u{Dc00}" // Invalid unicode code point
|
1
crates/swc/tests/exec/issues-2xxx/.2948/exec.js
Normal file
1
crates/swc/tests/exec/issues-2xxx/.2948/exec.js
Normal file
@ -0,0 +1 @@
|
||||
console.log("\u{Dc00}") // Invalid unicode code point
|
@ -5,4 +5,6 @@ var p;
|
||||
|
||||
[(b)] = [3]; // correct
|
||||
({ p: (d) } = {}); // correct
|
||||
[(parseInt.prop)] = [3]; // correct
|
||||
[(parseInt.prop)] = [3]; // correct
|
||||
|
||||
console.log('Pass')
|
@ -2,5 +2,8 @@ class A {
|
||||
#a = 123n
|
||||
foo() {
|
||||
this.#a++
|
||||
console.log(this.#a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(new A).foo()
|
@ -1,63 +0,0 @@
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
var _marked = regeneratorRuntime.mark(f);
|
||||
function f() {
|
||||
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step;
|
||||
return regeneratorRuntime.wrap(function f$(_ctx) {
|
||||
while(1)switch(_ctx.prev = _ctx.next){
|
||||
case 0:
|
||||
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
||||
_ctx.prev = 1;
|
||||
_loop = function(_iterator, _step) {
|
||||
var i = _step.value;
|
||||
setTimeout(function() {
|
||||
return console.log(i);
|
||||
}, 100);
|
||||
};
|
||||
for(_iterator = [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
][Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop(_iterator, _step);
|
||||
_ctx.next = 10;
|
||||
break;
|
||||
case 6:
|
||||
_ctx.prev = 6;
|
||||
_ctx.t0 = _ctx["catch"](1);
|
||||
_didIteratorError = true;
|
||||
_iteratorError = _ctx.t0;
|
||||
case 10:
|
||||
_ctx.prev = 10;
|
||||
_ctx.prev = 11;
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
case 13:
|
||||
_ctx.prev = 13;
|
||||
if (!_didIteratorError) {
|
||||
_ctx.next = 16;
|
||||
break;
|
||||
}
|
||||
throw _iteratorError;
|
||||
case 16:
|
||||
return _ctx.finish(13);
|
||||
case 17:
|
||||
return _ctx.finish(10);
|
||||
case 18:
|
||||
case "end":
|
||||
return _ctx.stop();
|
||||
}
|
||||
}, _marked, null, [
|
||||
[
|
||||
1,
|
||||
6,
|
||||
10,
|
||||
18
|
||||
],
|
||||
[
|
||||
11,
|
||||
,
|
||||
13,
|
||||
17
|
||||
]
|
||||
]);
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
import regeneratorRuntime from "regenerator-runtime";
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
||||
try {
|
||||
var info = gen[key](arg);
|
||||
var value = info.value;
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
if (info.done) {
|
||||
resolve(value);
|
||||
} else {
|
||||
Promise.resolve(value).then(_next, _throw);
|
||||
}
|
||||
}
|
||||
function _asyncToGenerator(fn) {
|
||||
return function() {
|
||||
var self = this, args = arguments;
|
||||
return new Promise(function(resolve, reject) {
|
||||
var gen = fn.apply(self, args);
|
||||
function _next(value) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
||||
}
|
||||
function _throw(err) {
|
||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
||||
}
|
||||
_next(undefined);
|
||||
});
|
||||
};
|
||||
}
|
||||
function f() {
|
||||
return _f.apply(this, arguments);
|
||||
}
|
||||
function _f() {
|
||||
_f = _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
||||
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step;
|
||||
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
||||
while(1)switch(_ctx.prev = _ctx.next){
|
||||
case 0:
|
||||
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
||||
_ctx.prev = 1;
|
||||
_loop = function(_iterator, _step) {
|
||||
var i = _step.value;
|
||||
setTimeout(function() {
|
||||
return console.log(i);
|
||||
}, 100);
|
||||
};
|
||||
for(_iterator = [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
][Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop(_iterator, _step);
|
||||
_ctx.next = 10;
|
||||
break;
|
||||
case 6:
|
||||
_ctx.prev = 6;
|
||||
_ctx.t0 = _ctx["catch"](1);
|
||||
_didIteratorError = true;
|
||||
_iteratorError = _ctx.t0;
|
||||
case 10:
|
||||
_ctx.prev = 10;
|
||||
_ctx.prev = 11;
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
case 13:
|
||||
_ctx.prev = 13;
|
||||
if (!_didIteratorError) {
|
||||
_ctx.next = 16;
|
||||
break;
|
||||
}
|
||||
throw _iteratorError;
|
||||
case 16:
|
||||
return _ctx.finish(13);
|
||||
case 17:
|
||||
return _ctx.finish(10);
|
||||
case 18:
|
||||
case "end":
|
||||
return _ctx.stop();
|
||||
}
|
||||
}, _callee, null, [
|
||||
[
|
||||
1,
|
||||
6,
|
||||
10,
|
||||
18
|
||||
],
|
||||
[
|
||||
11,
|
||||
,
|
||||
13,
|
||||
17
|
||||
]
|
||||
]);
|
||||
}));
|
||||
return _f.apply(this, arguments);
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
export var foo = function() {
|
||||
return 2;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9rZHkxL3Byb2plY3RzL3N3Yy1idWdzL3Rlc3RzL2ZpeHR1cmUvaXNzdWUtMTU4MS9jYXNlMS9pbnB1dC9pbmRleC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgZm9vID0gKCkgPT4ge1xuICAgIHJldHVybiAyO1xufTsiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IldBQWEsR0FBRztXQUNMLENBQUMifQ==
|
@ -1,8 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.bar = void 0;
|
||||
var bar = function() {
|
||||
};
|
||||
exports.bar = bar;
|
@ -1,8 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.foo = void 0;
|
||||
var foo = function() {
|
||||
};
|
||||
exports.foo = foo;
|
@ -1,26 +0,0 @@
|
||||
"use strict";
|
||||
var lib = _interopRequireWildcard(require("./lib"));
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
} else {
|
||||
var newObj = {
|
||||
};
|
||||
if (obj != null) {
|
||||
for(var key in obj){
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
|
||||
};
|
||||
if (desc.get || desc.set) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
}
|
||||
console.log(lib);
|
@ -1,53 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {
|
||||
};
|
||||
var _foo = _interopRequireWildcard(require("./foo"));
|
||||
var _bar = _interopRequireWildcard(require("./bar"));
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
} else {
|
||||
var newObj = {
|
||||
};
|
||||
if (obj != null) {
|
||||
for(var key in obj){
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
|
||||
};
|
||||
if (desc.get || desc.set) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
}
|
||||
Object.keys(_foo).forEach(function(key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _foo[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _foo[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.keys(_bar).forEach(function(key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _bar[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _bar[key];
|
||||
}
|
||||
});
|
||||
});
|
@ -1,12 +0,0 @@
|
||||
function fn1(param) {
|
||||
var x = param.x, y = param.y;
|
||||
return x + y;
|
||||
}
|
||||
function fn2(param) {
|
||||
var x = param.x, y = param.y;
|
||||
var fn3 = fn1;
|
||||
return fn3({
|
||||
x: x,
|
||||
y: y
|
||||
});
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user