Skip to content

Commit

Permalink
test(es): Support tsc multi-file unit tests (swc-project#5316)
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari authored and kdy1 committed Jul 29, 2022
1 parent 7309091 commit 1b0d9f7
Show file tree
Hide file tree
Showing 1,712 changed files with 23,605 additions and 7,213 deletions.
12 changes: 12 additions & 0 deletions crates/swc/tests/tsc-references/1.0lib-noErrors_es2015.1.normal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//!
//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode
//! ,----
//! 30 | declare function eval(x: string): any;
//! : ^^^^
//! `----
//!
//!
//!Caused by:
//! 0: failed to process input file
//! 1: error was recoverable, but proceeding would result in wrong codegen
//! 2: Syntax Error
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//!
//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode
//! ,----
//! 30 | declare function eval(x: string): any;
//! : ^^^^
//! `----
//!
//!
//!Caused by:
//! 0: failed to process input file
//! 1: error was recoverable, but proceeding would result in wrong codegen
//! 2: Syntax Error
12 changes: 12 additions & 0 deletions crates/swc/tests/tsc-references/1.0lib-noErrors_es5.1.normal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//!
//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode
//! ,----
//! 30 | declare function eval(x: string): any;
//! : ^^^^
//! `----
//!
//!
//!Caused by:
//! 0: failed to process input file
//! 1: error was recoverable, but proceeding would result in wrong codegen
//! 2: Syntax Error
12 changes: 12 additions & 0 deletions crates/swc/tests/tsc-references/1.0lib-noErrors_es5.2.minified.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//!
//! x 'eval' and 'arguments' cannot be used as a binding identifier in strict mode
//! ,----
//! 30 | declare function eval(x: string): any;
//! : ^^^^
//! `----
//!
//!
//!Caused by:
//! 0: failed to process input file
//! 1: error was recoverable, but proceeding would result in wrong codegen
//! 2: Syntax Error
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @filename: module.d.ts
// @filename: function.d.ts
// @filename: test.ts
var cl;
var cl = Point();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @filename: module.d.ts
// @filename: function.d.ts
// @filename: test.ts
var cl;
var cl = Point();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @filename: module.d.ts
// @filename: class.d.ts
// @filename: test.ts
var p;
var p = A.Point.Origin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @filename: module.d.ts
// @filename: class.d.ts
// @filename: test.ts
var p;
var p = A.Point.Origin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ var A;
constructor(x, y){
this.x = x, this.y = y;
}
}, A.Point.Origin, new A.Point(0, 0);
};
A.Point.Origin, new A.Point(0, 0);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @filename: module.d.ts
import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
// @filename: classPoint.ts
import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
var A;
(function(A) {
var Point = function Point(x, y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
_class_call_check(this, Point), this.x = x, this.y = y;
};
A.Point = Point;
}(A || (A = {})), A.Point.Origin, new A.Point(0, 0);
}(A || (A = {}));
A.Point.Origin, new A.Point(0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Point(), Point.Origin;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Point(), Point.Origin;
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ var X;
Y.Point = Point;
})(Y = X.Y || (X.Y = {}));
})(X || (X = {}));
// @filename: module.ts
var X;
(function(X) {
let Y;
(function(Y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ var X;
this.x = x, this.y = y;
}
};
}(X || (X = {})), function(X) {
}(X || (X = {}));
var X;
!function(X) {
var Y;
let Point;
(Point = (Y = X.Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0);
}(X || (X = {})), new X.Y.Point(1, 1), X.Y.Point.Origin;
}(X || (X = {}));
new X.Y.Point(1, 1), X.Y.Point.Origin;
class A {
}
(A || (A = {})).Instance = new A(), A.Instance, new A();
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ var X;
Y.Point = Point;
})(Y = X.Y || (X.Y = {}));
})(X || (X = {}));
// @filename: module.ts
var X;
(function(X) {
var Y;
(function(Y) {
Expand All @@ -28,6 +30,7 @@ var X;
var cl = new X.Y.Point(1, 1);
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
// @filename: simple.ts
import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
var A = function A() {
"use strict";
_class_call_check(this, A);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
var X;
import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
!function(X) {
var Y, Point;
Y = X.Y || (X.Y = {}), Point = function(x, y) {
"use strict";
_class_call_check(this, Point), this.x = x, this.y = y;
}, Y.Point = Point;
}(X || (X = {})), function(X) {
}(X || (X = {}));
var X;
!function(X) {
var Y, Point;
(Point = (Y = X.Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0);
}(X || (X = {})), new X.Y.Point(1, 1), X.Y.Point.Origin;
var X, A = function() {
}(X || (X = {}));
new X.Y.Point(1, 1), X.Y.Point.Origin;
import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
var A = function() {
"use strict";
_class_call_check(this, A);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var X;
Y.Point = Point;
})(Y = X.Y || (X.Y = {}));
})(X || (X = {}));
// @filename: module.ts
var X;
(function(X) {
let Y;
(function(Y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ var X;
this.x = x, this.y = y;
}
};
}(X || (X = {})), function(X) {
}(X || (X = {}));
var X;
!function(X) {
var Y;
let Point;
(Point = (Y = X.Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0);
}(X || (X = {})), new X.Y.Point(1, 1), X.Y.Point.Origin;
}(X || (X = {}));
new X.Y.Point(1, 1), X.Y.Point.Origin;
class A {
}
(A || (A = {})).Instance = new A(), A.Instance, new A();
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ var X;
Y.Point = Point;
})(Y = X.Y || (X.Y = {}));
})(X || (X = {}));
// @filename: module.ts
var X;
(function(X) {
var Y;
(function(Y) {
Expand All @@ -27,6 +29,7 @@ var X;
var cl = new X.Y.Point(1, 1);
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
// @filename: simple.ts
import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
var A = function A() {
"use strict";
_class_call_check(this, A);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
var X;
import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
!function(X) {
var Y, Point;
Y = X.Y || (X.Y = {}), Point = function(x, y) {
"use strict";
_class_call_check(this, Point), this.x = x, this.y = y;
}, Y.Point = Point;
}(X || (X = {})), function(X) {
}(X || (X = {}));
var X;
!function(X) {
var Y, Point;
(Point = (Y = X.Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0);
}(X || (X = {})), new X.Y.Point(1, 1), X.Y.Point.Origin;
var X, A = function() {
}(X || (X = {}));
new X.Y.Point(1, 1), X.Y.Point.Origin;
import _class_call_check from "@swc/helpers/src/_class_call_check.mjs";
var A = function() {
"use strict";
_class_call_check(this, A);
};
Expand Down
12 changes: 12 additions & 0 deletions crates/swc/tests/tsc-references/ES5For-of12_es2015.1.normal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//!
//! x Cannot assign to this
//! ,----
//! 1 | for ([""] of [[""]]) { }
//! : ^^
//! `----
//!
//!
//!Caused by:
//! 0: failed to process input file
//! 1: error was recoverable, but proceeding would result in wrong codegen
//! 2: Syntax Error
12 changes: 12 additions & 0 deletions crates/swc/tests/tsc-references/ES5For-of12_es2015.2.minified.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//!
//! x Cannot assign to this
//! ,----
//! 1 | for ([""] of [[""]]) { }
//! : ^^
//! `----
//!
//!
//!Caused by:
//! 0: failed to process input file
//! 1: error was recoverable, but proceeding would result in wrong codegen
//! 2: Syntax Error
12 changes: 12 additions & 0 deletions crates/swc/tests/tsc-references/ES5For-of12_es5.1.normal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//!
//! x Cannot assign to this
//! ,----
//! 1 | for ([""] of [[""]]) { }
//! : ^^
//! `----
//!
//!
//!Caused by:
//! 0: failed to process input file
//! 1: error was recoverable, but proceeding would result in wrong codegen
//! 2: Syntax Error
12 changes: 12 additions & 0 deletions crates/swc/tests/tsc-references/ES5For-of12_es5.2.minified.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//!
//! x Cannot assign to this
//! ,----
//! 1 | for ([""] of [[""]]) { }
//! : ^^
//! `----
//!
//!
//!Caused by:
//! 0: failed to process input file
//! 1: error was recoverable, but proceeding would result in wrong codegen
//! 2: Syntax Error
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var A;
}
A.Point = Point;
})(A || (A = {}));
// @filename: module.ts
var A;
(function(A) {
let Point;
(function(Point) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
var A, B;
var A;
(A || (A = {})).Point = function() {
return {
x: 0,
y: 0
};
}, function(A) {
};
var A;
!function(A) {
(A.Point || (A.Point = {})).Origin = {
x: 0,
y: 0
};
}(A || (A = {})), A.Point, A.Point(), A.Point.Origin, function(B) {
}(A || (A = {}));
A.Point, A.Point(), A.Point.Origin;
var B;
!function(B) {
function Point() {
return {
x: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var A;
};
A.Point = Point;
})(A || (A = {}));
// @filename: module.ts
var A;
(function(A) {
var Point;
(function(Point) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var A, B;
var A;
!function(A) {
var Point = function() {
return {
Expand All @@ -7,12 +7,17 @@ var A, B;
};
};
A.Point = Point;
}(A || (A = {})), function(A) {
}(A || (A = {}));
var A;
!function(A) {
(A.Point || (A.Point = {})).Origin = {
x: 0,
y: 0
};
}(A || (A = {})), A.Point, A.Point(), A.Point.Origin, function(B) {
}(A || (A = {}));
A.Point, A.Point(), A.Point.Origin;
var B;
!function(B) {
var Point = function() {
return {
x: 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
var A, B;
var A;
(A || (A = {})).Point = function() {
return {
x: 0,
y: 0
};
}, function(B) {
};
var B;
!function(B) {
(B.Point || (B.Point = {})).Origin = {
x: 0,
y: 0
};
}(B || (B = {})), A.Point, B.Point.Origin;
}(B || (B = {}));
A.Point, B.Point.Origin;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var A, B;
var A;
!function(A) {
var Point = function() {
return {
Expand All @@ -7,9 +7,12 @@ var A, B;
};
};
A.Point = Point;
}(A || (A = {})), function(B) {
}(A || (A = {}));
var B;
!function(B) {
(B.Point || (B.Point = {})).Origin = {
x: 0,
y: 0
};
}(B || (B = {})), A.Point, B.Point.Origin;
}(B || (B = {}));
A.Point, B.Point.Origin;
Loading

0 comments on commit 1b0d9f7

Please sign in to comment.