Skip to content

Commit

Permalink
Fix JS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
K0IN committed Jul 31, 2024
1 parent ebd97e5 commit 5c0a1b2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions src/test/suite/javascript.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ suite('Test javascript compatibility', function () {

validateStacktraceInfo(stackTraceInfo, [
{
code: "printStackTrace() {\r\n console.trace(`Stack trace for ${this.name}`);\r\n }",
file: "/e:/src/stacktrace-history/test_code/javascript_node/index.js",
code: "printStackTrace() {\n console.trace(`Stack trace for ${this.name}`);\n }",
file: "test_code/javascript_node/index.js",
frameId: 0,
language: "javascript",
fileLocationOffset: {
Expand All @@ -54,8 +54,8 @@ suite('Test javascript compatibility', function () {
},
},
{
code: "callGrandchild() {\r\n const grandchild = new Grandchild();\r\n grandchild.printStackTrace();\r\n }",
file: "/e:/src/stacktrace-history/test_code/javascript_node/index.js",
code: "callGrandchild() {\n const grandchild = new Grandchild();\n grandchild.printStackTrace();\n }",
file: "test_code/javascript_node/index.js",
frameId: 1,
language: "javascript",
fileLocationOffset: {
Expand All @@ -68,8 +68,8 @@ suite('Test javascript compatibility', function () {
},
},
{
code: "callChild() {\r\n const child = new Child();\r\n child.callGrandchild();\r\n }",
file: "/e:/src/stacktrace-history/test_code/javascript_node/index.js",
code: "callChild() {\n const child = new Child();\n child.callGrandchild();\n }",
file: "test_code/javascript_node/index.js",
frameId: 2,
language: "javascript",
fileLocationOffset: {
Expand All @@ -82,8 +82,8 @@ suite('Test javascript compatibility', function () {
},
},
{
code: "}\r\n\r\nconst obj = new Parent();\r\nobj.callChild();\r\n\r\nfunction showAllStackTraces() {\r\n const grandchild = new Grandchild();",
file: "/e:/src/stacktrace-history/test_code/javascript_node/index.js",
code: "}\n\nconst obj = new Parent();\nobj.callChild();\n\nfunction showAllStackTraces() {\n const grandchild = new Grandchild();",
file: "test_code/javascript_node/index.js",
frameId: 3,
language: "javascript",
fileLocationOffset: {
Expand Down
16 changes: 8 additions & 8 deletions src/test/suite/python.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ suite('Test python compatibility', function () {
assert.ok(stackTraceInfo, 'Failed to get stack trace info');
validateStacktraceInfo(stackTraceInfo, [
{
code: "def dummy_method(self):\r\n \"\"\"dummy method\"\"\"\r\n print(\"This is a dummy method\", self.a, self.b)",
file: "/e:/src/stacktrace-history/test_code/python/main.py",
code: "def dummy_method(self):\n \"\"\"dummy method\"\"\"\n print(\"This is a dummy method\", self.a, self.b)",
file: "test_code/python/main.py",
frameId: 2,
language: "python",
fileLocationOffset: {
Expand All @@ -58,8 +58,8 @@ suite('Test python compatibility', function () {
},
},
{
code: "def deep_code():\r\n \"\"\"i do stuff\"\"\"\r\n a = {\"a\": 1, \"b\": 2, \"c\": 3}\r\n x = Dummy()\r\n x.dummy_method()\r\n b = 2\r\n c = 1 + b\r\n d = c ** c\r\n print(\"This is a deep code\", c, d)\r\n\r\n def lol():\r\n print(\"This is a lol function\")\r\n lol()",
file: "/e:/src/stacktrace-history/test_code/python/main.py",
code: "def deep_code():\n \"\"\"i do stuff\"\"\"\n a = {\"a\": 1, \"b\": 2, \"c\": 3}\n x = Dummy()\n x.dummy_method()\n b = 2\n c = 1 + b\n d = c ** c\n print(\"This is a deep code\", c, d)\n\n def lol():\n print(\"This is a lol function\")\n lol()",
file: "test_code/python/main.py",
frameId: 3,
language: "python",
fileLocationOffset: {
Expand All @@ -72,8 +72,8 @@ suite('Test python compatibility', function () {
},
},
{
code: "def main():\r\n \"\"\"main code\"\"\"\r\n print(\"This is a main code\")\r\n a = 1\r\n b = 2\r\n c = a + b\r\n deep_code()\r\n deep_code()\r\n deep_code()",
file: "/e:/src/stacktrace-history/test_code/python/main.py",
code: "def main():\n \"\"\"main code\"\"\"\n print(\"This is a main code\")\n a = 1\n b = 2\n c = a + b\n deep_code()\n deep_code()\n deep_code()",
file: "test_code/python/main.py",
frameId: 4,
language: "python",
fileLocationOffset: {
Expand All @@ -86,8 +86,8 @@ suite('Test python compatibility', function () {
},
},
{
code: "\r\nif __name__ == \"__main__\":\r\n a = 1337\r\n main()\r\n",
file: "/e:/src/stacktrace-history/test_code/python/main.py",
code: "\nif __name__ == \"__main__\":\n a = 1337\n main()\n",
file: "test_code/python/main.py",
frameId: 5,
language: "python",
fileLocationOffset: {
Expand Down
4 changes: 2 additions & 2 deletions src/test/suite/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ function validateSerializedRange(value: SerializedRange, expected: SerializedRan
}

function validateCallLocation(value: CallLocation, expected: CallLocation) {
assert.ok(value.frameId, "FrameId is not set"); // this can differ from call to call
assert.ok(value.frameId !== undefined, "FrameId is not set"); // this can differ from call to call

assert.equal(value.code, expected.code, "Code does not match");
assert.equal(value.file, expected.file, "File does not match");
assert.ok(value.file.endsWith(expected.file), "File does not match");
assert.equal(value.language, expected.language, "Language does not match");

validateSerializedRange(value.fileLocationOffset, expected.fileLocationOffset);
Expand Down

0 comments on commit 5c0a1b2

Please sign in to comment.