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 6, 2023
1 parent 16f8c4f commit ee2f568
Show file tree
Hide file tree
Showing 26 changed files with 38 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class Shard extends _utils.Emitter {
} else if (emit) {
this.emit(_utils.ShardEvent.DESTROYED);
}
// (Step 3) Make the websocket connection prop undefined.
_class_private_field_set._(this, _ws1, undefined);
// (Step 4) Set the shard status to disconnected.
this.status = _utils.Status.DISCONNECTED;
Expand All @@ -138,6 +139,7 @@ class Shard extends _utils.Emitter {
_class_private_field_set._(this, _seq, -1);
this.session.reset();
}
// (Step 7) Reset ze bucket!
_class_private_field_set._(this, _bucket, new _utils.Bucket(120, 6e4));
}
connect() {
Expand Down Expand Up @@ -406,6 +408,7 @@ class Shard extends _utils.Emitter {
* Guilds that are expected to be received.
* @type {Set<string>}
*/ this.expectedGuilds = new Set();
// Private shit
_class_private_field_set._(this, _seq, -1);
_class_private_field_set._(this, _closingSeq, 0);
_class_private_field_set._(this, _queue, []);
Expand Down
1 change: 1 addition & 0 deletions crates/swc/tests/fixture/issues-2xxx/2926/output/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export var webpackJsonpCallback = function(parentChunkLoadingFunction, data) {
/******/ var runtime = data[2];
//......
runtime && runtime(__webpack_require__);
// return result
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/************************************************************************/ /******/ /******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = {
/***/ 746: /***/ function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__1) {
// originally from react
Object.prototype.hasOwnProperty;
// END MY ACTUAL CODE
/***/ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ function _simulateTransaction() {
// @ts-ignore
transaction.recentBlockhash = _state.sent();
signData = transaction.serializeMessage();
// @ts-ignore
wireTransaction = transaction._serialize(signData);
encodedTransaction = wireTransaction.toString("base64");
config = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ var Router = /*#__PURE__*/ function() {
if (!_this.urlIsNew(cleanedAs) && !localeChange) {
method = "replaceState";
}
// we need to resolve the as value using rewrites for dynamic SSG
// pages to allow building the data URL correctly
resolvedAs = as;
// url and as should always be prefixed with basePath by this
// point by either next/link or router.push/replace so strip the
Expand Down Expand Up @@ -315,6 +317,7 @@ var Router = /*#__PURE__*/ function() {
// when updating query information
props.pageProps.statusCode = 500;
}
// shallow routing is only allowed for same page URL changes.
isValidShallowRoute = options.shallow && _this.route === route;
shouldScroll = (_options_scroll = options.scroll) !== null && _options_scroll !== void 0 ? _options_scroll : !isValidShallowRoute;
resetScroll = shouldScroll ? {
Expand Down
7 changes: 6 additions & 1 deletion crates/swc/tests/fixture/sourcemap/006/output/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ it("should compress avif smaller than webp and smaller than jpg", /*#__PURE__*/
return _ts_generator(this, function(_state) {
switch(_state.label){
case 0:
query = {
/**
*
* 'Foo bar baz'
*
* Return @
*/ query = {
url: "/test.jpg",
w: w,
q: 75
Expand Down
2 changes: 1 addition & 1 deletion crates/swc/tests/fixture/sourcemap/006/output/index.map
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"mappings": ";;AAAAA,GAAG,6EAA+D,oBAAA;QAOxDC,OACAC,MAQAC,MAQAC,MAQAC,MACAC,MACAC;;;;gBA3BAN,QAAQ;oBAAEO,KAAK;oBAAaC,GAAAA;oBAAGC,GAAG;gBAAG;gBAC9B;;oBAAMC,aAAaC,SAAS,gBAAgBX,OAAO;wBAC5DY,SAAS;4BACLC,QAAQ;wBACZ;oBACJ;;;gBAJMZ,OAAO;gBAKba,OAAOb,KAAKc,MAAM,EAAEC,IAAI,CAAC;gBACzBF,OAAOb,KAAKW,OAAO,CAACK,GAAG,CAAC,iBAAiBD,IAAI,CAAC;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AO,CAACK,GAAG,CAAC,iBAAiBD,IAAI,CAAC;gBAEjC;;oBAAMN,aAAaC,SAAS,gBAAgBX,OAAO;wBAC5DY,SAAS;4BACLC,QAAQ;wBACZ;oBACJ;;;gBAJMX,OAAO;gBAKbY,OAAOZ,KAAKa,MAAM,EAAEC,IAAI,CAAC;gBACzBF,OAAOZ,KAAKU,OAAO,CAACK,GAAG,CAAC,iBAAiBD,IAAI,CAAC;gBAEjC;;oBAAMN,aAAaC,SAAS,gBAAgBX,OAAO;wBAC5DY,SAAS;4BACLC,QAAQ;wBACZ;oBACJ;;;gBAJMV,OAAO;gBAKbW,OAAOX,KAAKY,MAAM,EAAEC,IAAI,CAAC;gBACzBF,OAAOX,KAAKS,OAAO,CAACK,GAAG,CAAC,iBAAiBD,IAAI,CAAC;gBAEhC;;oBAAMf,KAAKiB,MAAM;;;gBAAzBd,OAAO,AAAC,cAAqBe,UAAU;gBAC/B;;oBAAMjB,KAAKgB,MAAM;;;gBAAzBb,OAAO,AAAC,cAAqBc,UAAU;gBAC/B;;oBAAMhB,KAAKe,MAAM;;;gBAAzBZ,OAAO,AAAC,cAAqBa,UAAU;gBAE7CC,QAAQC,GAAG,CAAC;oBAAEC,SAAAA;oBAASd,GAAAA;oBAAGJ,MAAAA;oBAAMC,MAAAA;oBAAMC,MAAAA;gBAAK;gBAE3CQ,OAAOT,MAAMkB,YAAY,CAACjB;gBAC1BQ,OAAOV,MAAMmB,YAAY,CAAClB;;;;;;AAC9B",
"names": [
"it",
"query",
Expand Down
3 changes: 1 addition & 2 deletions crates/swc/tests/stacktrace/case-1/output/stacks.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$DIR/tests/stacktrace/case-1/input/index.js:5
throw new Error('Boom')
^

^

Error: Boom
at <anonymous> ($DIR/tests/stacktrace/case-1/input/index.js:5:15)
Expand Down
3 changes: 1 addition & 2 deletions crates/swc/tests/stacktrace/deno-10014/output/stacks.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$DIR/tests/stacktrace/deno-10014/input/index.js:10
throw new Error("Hello");
^

^

Error: Hello
at t ($DIR/tests/stacktrace/deno-10014/input/index.js:10:15)
Expand Down
3 changes: 1 addition & 2 deletions crates/swc/tests/stacktrace/issue-1685/output/stacks.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$DIR/tests/stacktrace/issue-1685/input/index.js:3
throw new Error('Error here');
^

^

Error: Error here
at console ($DIR/tests/stacktrace/issue-1685/input/index.js:3:7)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$DIR/tests/stacktrace/issue-1796/es2015/input/index.js:3
throw new Error('Boom');
^

^

Error: Boom
at <anonymous> ($DIR/tests/stacktrace/issue-1796/es2015/input/index.js:3:15)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$DIR/tests/stacktrace/issue-1796/es2016/input/index.js:3
throw new Error('Boom');
^

^

Error: Boom
at <anonymous> ($DIR/tests/stacktrace/issue-1796/es2016/input/index.js:3:15)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$DIR/tests/stacktrace/issue-1796/es2017/input/index.js:3
throw new Error('Boom');
^

^

Error: Boom
at <anonymous> ($DIR/tests/stacktrace/issue-1796/es2017/input/index.js:3:15)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$DIR/tests/stacktrace/issue-1796/es2018/input/index.js:3
throw new Error('Boom');
^

^

Error: Boom
at <anonymous> ($DIR/tests/stacktrace/issue-1796/es2018/input/index.js:3:15)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$DIR/tests/stacktrace/issue-1796/es2019/input/index.js:3
throw new Error('Boom');
^

^

Error: Boom
at <anonymous> ($DIR/tests/stacktrace/issue-1796/es2019/input/index.js:3:15)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$DIR/tests/stacktrace/issue-1796/es2020/input/index.js:3
throw new Error('Boom');
^

^

Error: Boom
at <anonymous> ($DIR/tests/stacktrace/issue-1796/es2020/input/index.js:3:15)
Expand Down
3 changes: 1 addition & 2 deletions crates/swc/tests/stacktrace/issue-1796/es5/output/stacks.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$DIR/tests/stacktrace/issue-1796/es5/input/index.js:3
throw new Error('Boom');
^

^

Error: Boom
at <anonymous> ($DIR/tests/stacktrace/issue-1796/es5/input/index.js:3:15)
Expand Down
1 change: 0 additions & 1 deletion crates/swc/tests/stacktrace/issue-622/output/stacks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ $DIR/tests/stacktrace/issue-622/input/index.js:3
throw call();
^


ReferenceError: call is not defined
at <anonymous> ($DIR/tests/stacktrace/issue-622/input/index.js:3:9)
at step ($DIR/tests/stacktrace/issue-622/input/_exec.js:109:23)
Expand Down
3 changes: 1 addition & 2 deletions crates/swc/tests/stacktrace/issue-7506/output/stacks.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
$DIR/tests/stacktrace/issue-7506/input/index.js:2
throw new Error()
^

^

Error
at getStackTrace ($DIR/tests/stacktrace/issue-7506/input/index.js:2:11)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ var B = /*#__PURE__*/ function(A) {
_superprop_get_y().call(_this1);
// call with element access
_superprop_get("x").call(_this1);
// property access (read)
a = _superprop_get_x();
// element access (read)
b = _superprop_get("x");
return [
2
Expand Down Expand Up @@ -89,7 +91,9 @@ var B = /*#__PURE__*/ function(A) {
_superprop_get_x().call(_this1);
// call with element access
_superprop_get("x").call(_this1);
// property access (read)
a = _superprop_get_x();
// element access (read)
b = _superprop_get("x");
// property access (assign)
_superprop_set_x(f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ var Conestoga = /*#__PURE__*/ function(Wagon1) {
function Conestoga(drunkOO) {
_class_call_check(this, Conestoga);
var _this;
// error: wrong type
_this = _super.call(this, "nope");
_this.drunkOO = drunkOO;
return _this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
cache.mobile = cache.phone = phone, cache.tablet = null;
return; // unambiguously identified as phone
}
// our rules haven't found a match -> try more general fallback rules
impl.isMobileFallback(userAgent) ? undefined === (phoneSized = MobileDetect.isPhoneSized(maxPhoneWidth)) ? (cache.mobile = impl.FALLBACK_MOBILE, cache.tablet = cache.phone = null) : phoneSized ? (cache.mobile = cache.phone = impl.FALLBACK_PHONE, cache.tablet = null) : (cache.mobile = cache.tablet = impl.FALLBACK_TABLET, cache.phone = null) : impl.isTabletFallback(userAgent) ? (cache.mobile = cache.tablet = impl.FALLBACK_TABLET, cache.phone = null) : // not mobile at all!
cache.mobile = cache.tablet = cache.phone = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @param {Second} s
* @param {Fs} f
*/ export function consume(t, s, f) {
Target.START;
/** @type {Target} */ Target.START;
}
/** @param {string} s */ export function ff(s) {
return(// element access with arbitrary string is an error only with noImplicitAny
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TypeScript1 = TypeScript || (TypeScript = {}), preFindEnclosingScope = function(
}, context.scopeStartAST = ast, context.enclosingClassDecl = ast;
break;
case NodeType.ObjectLit:
// Only consider target-typed object literals
ast.targetType && (context.scopeGetter = function() {
return ast.targetType.containedScope;
}, context.objectLiteralScopeGetter = function() {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/swc/tests/tsc-references/parserindenter.2.minified.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ Formatting1 = Formatting || (Formatting = {}), Indenter = function() {
}
// The parent node to take its indentation is the first parent that has indentation.
for(; null != parent && !parent.CanIndent();)parent = parent.Parent;
// Skip Program since it has no indentation
null != parent && parent.AuthorNode.Details.Kind != AuthorParseNodeKind.apnkProg && (offset = parent.AuthorNode.Details.StartOffset, indentNode = parent);
} else {
indentNode = tree.StartNodeSelf, offset = tree.StartNodePreviousSibling.Details.StartOffset;
Expand All @@ -289,6 +290,7 @@ Formatting1 = Formatting || (Formatting = {}), Indenter = function() {
}
if (null != indentNode) {
var indentOverride = this.GetLineIndentationForOffset(offset);
// Set the indentation on all the siblings to be the same as indentNode
this.smartIndent || null === tree.StartNodePreviousSibling || null == indentNode.Parent || ParseNodeExtensions.GetChildren(indentNode.Parent).foreach(function(sibling) {
sibling !== indentNode && sibling.CanIndent() && sibling.SetIndentationOverride(indentOverride);
});
Expand Down

0 comments on commit ee2f568

Please sign in to comment.