Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplify tests
  • Loading branch information
flimzy committed Jan 3, 2022
commit b56c331df21f88e286aa0b07f1e95aa10a368a9f
2 changes: 1 addition & 1 deletion compiler/gopherjspkg/fs_vfsdata.go

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

14 changes: 7 additions & 7 deletions compiler/natives/fs_vfsdata.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion compiler/natives/src/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func parseCallFrame(info *js.Object) basicFrame {

return basicFrame{
File: parts.Call("slice", 0, parts.Length()-2).Call("join", ":").
Call("replace", js.Global.Get("RegExp").New(`^\s+at `), "").String(),
Call("replace", js.Global.Get("RegExp").New(`^\s*at `), "").String(),
Line: parts.Index(parts.Length() - 2).Int(),
FuncName: "<none>",
}
Expand Down
45 changes: 12 additions & 33 deletions compiler/natives/src/runtime/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ func Test_parseCallFrame(t *testing.T) {
input: " at Array.forEach (<anonymous>)",
want: "Array.forEach <anonymous> 0",
},
{
name: "Chrome 96, file location only",
input: "at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js:31:225",
want: "<none> https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js 31",
},
{
name: "Chrome 96, aliased function",
input: "at k.e.$externalizeWrapper.e.$externalizeWrapper [as run] (https://gopherjs.github.io/playground/playground.js:5:30547)",
want: "run https://gopherjs.github.io/playground/playground.js 5",
},
}

for _, tt := range tests {
Expand All @@ -55,45 +65,14 @@ func Test_parseCallstack(t *testing.T) {
{
name: "Chrome 96.0.4664.110 on Linux",
input: `at foo (eval at $b (https://gopherjs.github.io/playground/playground.js:102:11836), <anonymous>:25887:60)
at main (eval at $b (https://gopherjs.github.io/playground/playground.js:102:11836), <anonymous>:25880:8)
at $init (eval at $b (https://gopherjs.github.io/playground/playground.js:102:11836), <anonymous>:25970:9)
at $goroutine (eval at $b (https://gopherjs.github.io/playground/playground.js:102:11836), <anonymous>:1602:19)
at $runScheduled (eval at $b (https://gopherjs.github.io/playground/playground.js:102:11836), <anonymous>:1648:7)
at $schedule (eval at $b (https://gopherjs.github.io/playground/playground.js:102:11836), <anonymous>:1672:5)
at $go (eval at $b (https://gopherjs.github.io/playground/playground.js:102:11836), <anonymous>:1634:3)
at eval (eval at $b (https://gopherjs.github.io/playground/playground.js:102:11836), <anonymous>:25982:1)
at eval (eval at $b (https://gopherjs.github.io/playground/playground.js:102:11836), <anonymous>:25985:4)
at eval (<anonymous>)
at $b (https://gopherjs.github.io/playground/playground.js:102:11836)
at k.e.$externalizeWrapper.e.$externalizeWrapper [as run] (https://gopherjs.github.io/playground/playground.js:5:30547)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js:175:190
at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js:192:165
at k.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js:112:32)
at k.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js:112:310)
at HTMLInputElement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js:192:147)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js:31:225
at Array.forEach (<anonymous>)
at q (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js:7:280)
at HTMLInputElement.c (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js:31:207)`,
want: `foo https://gopherjs.github.io/playground/playground.js 102
main https://gopherjs.github.io/playground/playground.js 102
$init https://gopherjs.github.io/playground/playground.js 102
$goroutine https://gopherjs.github.io/playground/playground.js 102
$runScheduled https://gopherjs.github.io/playground/playground.js 102
$go https://gopherjs.github.io/playground/playground.js 102
eval https://gopherjs.github.io/playground/playground.js 102
eval https://gopherjs.github.io/playground/playground.js 102
eval 0
$b https://gopherjs.github.io/playground/playground.js 102
k.e.$externalizeWrapper.e.$externalizeWrapper [as run] https://gopherjs.github.io/playground/playground.js 5
at 0
at 0
k.$eval https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js 112
k.$apply https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js 112
eval <anonymous> 0
run https://gopherjs.github.io/playground/playground.js 5
HTMLInputElement.<anonymous> https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js 192
at 0
Array.forEach 0
q https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js 7
HTMLInputElement.c https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js 31`,
},
}
Expand Down