Skip to content

Commit

Permalink
Avoid creating global properties in StackTracesTreeTest.WithSourceMap (
Browse files Browse the repository at this point in the history
…#774)

Summary:
Pull Request resolved: #774

Creating global properties here means the test can break under certain
build configurations, since it can result in allocations that then
create additional entries.

Reviewed By: jpporto

Differential Revision: D37744060

fbshipit-source-id: 5d8dddef0e990fa54aad3464661bc2849a0d1c9f
  • Loading branch information
neildhar authored and facebook-github-bot committed Jul 10, 2022
1 parent 1dbf8fd commit aa83f8b
Showing 1 changed file with 53 additions and 43 deletions.
96 changes: 53 additions & 43 deletions unittests/VMRuntime/StackTracesTreeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,13 +787,15 @@ TEST_F(StackTracesTreeTest, WithSourceMap) {

ASSERT_TRUE(runWithSourceMap(
R"#(
function bar() {
return new Object();
};
function foo() {
return bar();
};
foo();
(function (){
function bar() {
return new Object();
};
function foo() {
return bar();
};
return foo();
})();
)#",
sourceMapGen));

Expand All @@ -817,36 +819,65 @@ foo();
{
"name": "global",
"scriptName": "JavaScript",
"line": 8,
"col": 4,
"line": 10,
"col": 3,
"children": [
{
"name": "foo",
"name": "(anonymous)",
"scriptName": "JavaScript",
"line": 6,
"line": 9,
"col": 13,
"children": [
{
"name": "bar",
"name": "foo",
"scriptName": "JavaScript",
"line": 3,
"col": 20,
"children": []
"line": 7,
"col": 15,
"children": [
{
"name": "bar",
"scriptName": "JavaScript",
"line": 4,
"col": 22,
"children": []
},
{
"name": "bar",
"scriptName": "JavaScript",
"line": 3,
"col": 3,
"children": []
}
]
},
{
"name": "bar",
"name": "foo",
"scriptName": "JavaScript",
"line": 2,
"col": 1,
"line": 6,
"col": 3,
"children": []
}
]
},
{
"name": "foo",
"name": "(anonymous)",
"scriptName": "JavaScript",
"line": 5,
"col": 1,
"line": 2,
"col": 2,
"children": []
},
{
"name": "(anonymous)",
"scriptName": "JavaScript",
"line": 2,
"col": 2,
"children": []
},
{
"name": "(anonymous)",
"scriptName": "JavaScript",
"line": 2,
"col": 2,
"children": []
}
]
Expand All @@ -855,28 +886,7 @@ foo();
"name": "global",
"scriptName": "JavaScript",
"line": 2,
"col": 1,
"children": []
},
{
"name": "global",
"scriptName": "JavaScript",
"line": 2,
"col": 1,
"children": []
},
{
"name": "global",
"scriptName": "JavaScript",
"line": 2,
"col": 1,
"children": []
},
{
"name": "global",
"scriptName": "JavaScript",
"line": 2,
"col": 1,
"col": 2,
"children": []
}
]
Expand Down

0 comments on commit aa83f8b

Please sign in to comment.