Skip to content

Commit

Permalink
chore: update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Sep 29, 2023
1 parent 004cb58 commit 809f7c6
Show file tree
Hide file tree
Showing 35 changed files with 86 additions and 89 deletions.
2 changes: 1 addition & 1 deletion crates/swc/tests/fixture/issues-2xxx/2214/output/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
export var Test;
(function(Test) {
var content = Test.content = /*#__PURE__*/ React.createElement("div", null, "Content");
Test.content = /*#__PURE__*/ React.createElement("div", null, "Content");
})(Test || (Test = {}));
2 changes: 1 addition & 1 deletion crates/swc/tests/fixture/issues-2xxx/2310/output/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var A;
(function(A) {
var Foo = A.Foo = function() {
A.Foo = function() {
return /*#__PURE__*/ React.createElement("div", null);
};
})(A || (A = {}));
2 changes: 1 addition & 1 deletion crates/swc/tests/fixture/issues-2xxx/2423/output/index.map
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"mappings": ";;UAAUA;IACC,MAAMC,MAAAA,IAAI;IACV,SAASC;QACZC,QAAQC,GAAG,CAACH;IAChB;MAFgBC,IAAAA;AAGpB,GALUF,MAAAA",
"mappings": ";;UAAUA;MACOC,IAAI;IACV,SAASC;QACZC,QAAQC,GAAG,GAACH;IAChB;MAFgBC,IAAAA;AAGpB,GALUF,MAAAA",
"names": [
"A",
"v",
Expand Down
4 changes: 2 additions & 2 deletions crates/swc/tests/fixture/issues-2xxx/2423/output/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use strict";
var A;
(function(A) {
const v = A.v = 25;
A.v = 25;
function a() {
console.log(v);
console.log(A.v);
}
A.a = a;
})(A || (A = {}));
4 changes: 2 additions & 2 deletions crates/swc/tests/fixture/issues-2xxx/2636/output/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export var RuleInterpreterHelper;
(function(RuleInterpreterHelper) {
var fieldNameMap = RuleInterpreterHelper.fieldNameMap = [];
var fieldNameHashMap = RuleInterpreterHelper.fieldNameHashMap = new Map(fieldNameMap);
RuleInterpreterHelper.fieldNameMap = [];
RuleInterpreterHelper.fieldNameHashMap = new Map(RuleInterpreterHelper.fieldNameMap);
})(RuleInterpreterHelper || (RuleInterpreterHelper = {}));
4 changes: 2 additions & 2 deletions crates/swc/tests/fixture/issues-3xxx/3073/1/output/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var n;
(function(n) {
var ref;
var a = (ref = {
ref = {
a: 1
}, n.a = ref.a, ref).a;
}, n.a = ref.a, ref;
})(n || (n = {}));
4 changes: 2 additions & 2 deletions crates/swc/tests/fixture/issues-3xxx/3073/2/output/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var Foo;
(function(Foo) {
var ref;
var _ref = (ref = {
ref = {
a: 1,
b: 2
}, Foo.A = ref.a, Foo.B = ref.b, ref), A = _ref.a, B = _ref.b;
}, Foo.A = ref.a, Foo.B = ref.b, ref;
})(Foo || (Foo = {}));
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var foo;
(function(foo) {
var bar = foo.bar = 0;
foo.bar = 0;
})(foo || (foo = {}));
export { foo };
2 changes: 1 addition & 1 deletion crates/swc/tests/fixture/issues-4xxx/4897/output/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ define([
}
var Foo;
(function(Foo) {
const Bar = Foo.Bar = 1234;
Foo.Bar = 1234;
})(Foo || (Foo = {}));
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var B;
})(B || (B = {}));
var Geometry;
(function(Geometry) {
var Points = Geometry.Points = A;
Geometry.Points = A;
var Lines = B;
Geometry.Origin = {
x: 0,
Expand Down
10 changes: 5 additions & 5 deletions crates/swc/tests/tsc-references/circularImportAlias.1.normal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { _ as _inherits } from "@swc/helpers/_/_inherits";
import { _ as _create_super } from "@swc/helpers/_/_create_super";
var B;
(function(B) {
var a = B.a = A;
var D = /*#__PURE__*/ function(_a_C) {
B.a = A;
var D = /*#__PURE__*/ function(_B_a_C) {
"use strict";
_inherits(D, _a_C);
_inherits(D, _B_a_C);
var _super = _create_super(D);
function D() {
_class_call_check(this, D);
return _super.apply(this, arguments);
}
return D;
}(a.C);
}(B.a.C);
B.D = D;
})(B || (B = {}));
var A;
Expand All @@ -25,7 +25,7 @@ var A;
_class_call_check(this, C);
};
A.C = C;
var b = A.b = B;
A.b = B;
})(A || (A = {}));
var c;
var c = new B.a.C();
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ var B, A, B1, D, A1;
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _inherits } from "@swc/helpers/_/_inherits";
import { _ as _create_super } from "@swc/helpers/_/_create_super";
D = function(_a_C) {
_inherits(D, _a_C);
(B1 = B || (B = {})).a = A, D = function(_B_a_C) {
_inherits(D, _B_a_C);
var _super = _create_super(D);
function D() {
return _class_call_check(this, D), _super.apply(this, arguments);
}
return D;
}(((B1 = B || (B = {})).a = A).C), B1.D = D, (A1 = A || (A = {})).C = function C() {
}(B1.a.C), B1.D = D, (A1 = A || (A = {})).C = function C() {
_class_call_check(this, C);
}, A1.b = B, new B.a.C();
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export var C = function C() {
_class_call_check(this, C);
};
(function(C) {
var x = C.x = 1;
C.x = 1;
})(C || (C = {}));
export var E;
(function(E) {
Expand All @@ -15,16 +15,16 @@ export var E;
E[E["x"] = 2] = "x";
})(E || (E = {}));
(function(E) {
var y = E.y = 1;
E.y = 1;
})(E || (E = {}));
(function(E) {
var z = E.z = 1;
E.z = 1;
})(E || (E = {}));
export var N;
(function(N) {
var x = N.x = 1;
N.x = 1;
})(N || (N = {}));
export function F() {}
(function(F) {
var x = F.x = 1;
F.x = 1;
})(F || (F = {}));
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export var C = function C() {
_class_call_check(this, C);
};
(function(C) {
var x = C.x = 1;
C.x = 1;
})(C || (C = {}));
export var E;
(function(E) {
Expand All @@ -15,16 +15,16 @@ export var E;
E[E["x"] = 2] = "x";
})(E || (E = {}));
(function(E) {
var y = E.y = 1;
E.y = 1;
})(E || (E = {}));
(function(E) {
var z = E.z = 1;
E.z = 1;
})(E || (E = {}));
export var N;
(function(N) {
var x = N.x = 1;
N.x = 1;
})(N || (N = {}));
export function F() {}
(function(F) {
var x = F.x = 1;
F.x = 1;
})(F || (F = {}));
7 changes: 4 additions & 3 deletions crates/swc/tests/tsc-references/exportImportAlias.1.normal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var A;
})(A || (A = {}));
var C;
(function(C) {
var a = C.a = A;
C.a = A;
})(C || (C = {}));
var a = C.a.x;
var b = new C.a.Point(0, 0);
Expand All @@ -38,7 +38,8 @@ var X;
})(X || (X = {}));
var Z;
(function(Z) {
var y = Z.y = X.Y;
// 'y' should be a fundule here
Z.y = X.Y;
})(Z || (Z = {}));
var m = Z.y();
var n = new Z.y.Point(0, 0);
Expand All @@ -56,7 +57,7 @@ var K;
})(K || (K = {}));
var M;
(function(M) {
var D = M.D = K.L;
M.D = K.L;
})(M || (M = {}));
var o;
var o = new M.D("Hello");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var ns;
_class_call_check(this, Class);
};
ns.Class = Class;
var Value = ns.Value = "";
ns.Value = "";
var nested;
(function(nested) {
var NestedClass = function NestedClass() {
Expand Down
2 changes: 1 addition & 1 deletion crates/swc/tests/tsc-references/typeOnlyMerge3.1.normal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export { };
//// [b.ts]
var A;
(function(A) {
var displayName = A.displayName = "A";
A.displayName = "A";
})(A || (A = {}));
export { A };
//// [c.ts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { A } from "./a";
//// [c.ts]
var A;
(function(A) {
var displayName = A.displayName = "A";
A.displayName = "A";
})(A || (A = {}));
A();
A.displayName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export { };
var f1 = NonExistent;
var Foo;
(function(Foo) {
var foo = Foo.foo = 1;
Foo.foo = 1;
})(Foo || (Foo = {}));
var f2 = Foo.foo;
var f3 = Foo.T;
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const I = require("./a");
"use strict";
var I;
(function(I) {
const x = I.x = 1;
I.x = 1;
})(I || (I = {}));
module.exports = I;
//// [/d.ts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard._(require("./
const x = 1; // error
var Values;
(function(Values) {
const x = Values.x = 1;
Values.x = 1;
})(Values || (Values = {}));
// sketchy, but ok
//// [/main2.ts]
Expand All @@ -51,7 +51,7 @@ module.exports = {
"use strict";
var ns;
(function(ns) {
const x = ns.x = 1;
ns.x = 1;
})(ns || (ns = {}));
module.exports = ns;
//// [/main4.ts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ var X;
(function(X) {
let Z;
(function(Z) {
const foo = Z.foo = 0;
Z.foo = 0;
})(Z = X.Z || (X.Z = {}));
})(X || (X = {}));
var Y;
(function(Y) {
let Z;
(function(Z) {
const bar = Z.bar = 1;
Z.bar = 1;
})(Z = Y.Z || (Y.Z = {}));
})(Y || (Y = {}));
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function Colors(member) {
return Colors.ValueFor(member);
}
(function(Colors) {
const ValueMap = Colors.ValueMap = {
Colors.ValueMap = {
Red: {
value: 0.0,
label: "Red"
Expand All @@ -16,17 +16,17 @@ export function Colors(member) {
label: "Green"
}
};
const Values = Colors.Values = [
Colors.Values = [
0.0,
1.0,
2.0
];
function ValueFor(member) {
return ValueMap[member]?.value;
return Colors.ValueMap[member]?.value;
}
Colors.ValueFor = ValueFor;
async function LabelFor(member) {
return ValueMap[member]?.label;
return Colors.ValueMap[member]?.label;
}
Colors.LabelFor = LabelFor;
})(Colors || (Colors = {}));
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export var TEST;
(function(TEST) {
const VALUE = TEST.VALUE = "value";
TEST.VALUE = "value";
})(TEST || (TEST = {}));
export default TEST;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export var TEST;
(function(TEST) {
const VAL1 = TEST.VAL1 = "value1";
const VAL2 = TEST.VAL2 = `${VAL1}_value2`;
TEST.VAL1 = "value1";
TEST.VAL2 = `${TEST.VAL1}_value2`;
})(TEST || (TEST = {}));
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var Foo;
(function(Foo) {
const { a } = { a: Foo.a } = {
({ a: Foo.a } = {
a: 1
};
});
})(Foo || (Foo = {}));
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var Bar;
(function(Bar) {
const { a, b } = { a: Bar.a, b: Bar.b } = {
({ a: Bar.a, b: Bar.b } = {
a: 1,
b: 2
};
});
})(Bar || (Bar = {}));
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var Baz;
(function(Baz) {
const baz = Baz.baz = {
Baz.baz = {
a: 1,
b: 2
};
Expand Down
Loading

0 comments on commit 809f7c6

Please sign in to comment.