Skip to content

Commit c70c04f

Browse files
committed
wasm/per-file: Link to the exact line for tests that have the info
1 parent 2af17a6 commit c70c04f

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

test262/per-file/main.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function generateResults() {
6767
Object.keys(results.results).map((name) => [
6868
name,
6969
{ [results.results[name]]: 1 },
70-
])
70+
]),
7171
);
7272

7373
return;
@@ -80,7 +80,7 @@ function generateResults() {
8080
for (const name in results.children) {
8181
const childResults = results.children[name];
8282
results.aggregatedResults = Object.keys(
83-
childResults.aggregatedResults
83+
childResults.aggregatedResults,
8484
).reduce((acc, mode) => {
8585
if (!(mode in acc)) acc[mode] = {};
8686
const modeAcc = acc[mode];
@@ -109,7 +109,7 @@ function generateResults() {
109109
summaryStatusLabel = document.getElementById("summary-status");
110110
leafTreeNodeTemplate = document.getElementById("leaf-tree-node-template");
111111
nonLeafTreeNodeTemplate = document.getElementById(
112-
"nonleaf-tree-node-template"
112+
"nonleaf-tree-node-template",
113113
);
114114

115115
// Now make a nice lazy-loaded collapsible tree in `resultsNode`.
@@ -192,7 +192,7 @@ function navigate() {
192192
history.pushState(
193193
{ pathInTree },
194194
pathInTree[pathInTree.length - 1],
195-
generateQueryString(pathInTree)
195+
generateQueryString(pathInTree),
196196
);
197197
regenerateResults(resultsNode);
198198
}
@@ -235,10 +235,10 @@ function generateChildNode(childName, child, filepath) {
235235
childNode.querySelector(".tree-node-name").textContent = childName;
236236
childNode.querySelector(".tree-node-name").title = filepath;
237237
childNode.querySelector(".tree-node-status").innerHTML = generateStatus(
238-
child.aggregatedResults
238+
child.aggregatedResults,
239239
);
240240
childNode.querySelector(".tree-node-github-url").href =
241-
window.config.generateGitHubURLFromTestPath(filepath);
241+
window.config.generateGitHubURLFromTestPath(filepath, childName);
242242
return childNode;
243243
}
244244

@@ -266,12 +266,12 @@ let checkASTOnly = true;
266266
function entryHasFilteredResultType([, child]) {
267267
if (checkASTOnly && "AST" in child.aggregatedResults) {
268268
return Object.keys(child.aggregatedResults.AST).some((type) =>
269-
shownResultTypes.has(type)
269+
shownResultTypes.has(type),
270270
);
271271
}
272272

273273
return Object.values(child.aggregatedResults).some((testType) =>
274-
Object.keys(testType).some((type) => shownResultTypes.has(type))
274+
Object.keys(testType).some((type) => shownResultTypes.has(type)),
275275
);
276276
}
277277

@@ -294,7 +294,7 @@ function regenerateResults(targetNode) {
294294
const childNode = generateChildNode(
295295
childName,
296296
child,
297-
`${pathInTree.join("/")}/${childName}`
297+
`${pathInTree.join("/")}/${childName}`,
298298
);
299299

300300
const isLeaf = child.children === null;
@@ -320,7 +320,7 @@ function regenerateResults(targetNode) {
320320
const childrenResults = searchResults(
321321
child.children,
322322
false,
323-
relativePath + "/"
323+
relativePath + "/",
324324
);
325325
if (isSearchedFor)
326326
childrenResults.push([childName, child, relativePath]);
@@ -348,7 +348,7 @@ function regenerateResults(targetNode) {
348348
const childrenResults = filterInternal(
349349
child.children,
350350
isSearchedFor,
351-
relativePath + "/"
351+
relativePath + "/",
352352
);
353353
if (!isSearchedFor && childrenResults.length === 0 && !allChildren)
354354
return [];
@@ -361,7 +361,7 @@ function regenerateResults(targetNode) {
361361

362362
let results = filterInternal(
363363
result,
364-
pathInTree.join("/").toLowerCase().includes(needle)
364+
pathInTree.join("/").toLowerCase().includes(needle),
365365
);
366366

367367
while (results.length === 1 && results[0][3] !== null)
@@ -380,7 +380,7 @@ function regenerateResults(targetNode) {
380380
const childNode = generateChildNode(
381381
childName,
382382
child,
383-
`${pathInTree.join("/")}/${relativePath}`
383+
`${pathInTree.join("/")}/${relativePath}`,
384384
);
385385

386386
if (child.children !== null) {
@@ -436,7 +436,7 @@ function generateStatus(aggregatedResults) {
436436
const stats = aggregatedResults[mode];
437437
const total = Object.keys(stats).reduce(
438438
(acc, name) => acc + stats[name],
439-
0
439+
0,
440440
);
441441
if (total === 0) return acc;
442442
acc.push(`<div class="mode-summary-container">
@@ -463,7 +463,7 @@ document.addEventListener("DOMContentLoaded", () => {
463463
promises.push(
464464
fetchData(path)
465465
.then((response) => response.json())
466-
.then((data) => initialize(data, mode))
466+
.then((data) => initialize(data, mode)),
467467
);
468468
}
469469
Promise.all(promises).then(() => generateResults());

wasm/per-file/index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
@@ -60,10 +60,12 @@ <h2>Per-file results</h2>
6060
window.config = {
6161
initialPathInTree: "Spec",
6262
loadPathsAndModes: [["wasm/per-file-master.json", "Default"]],
63-
generateGitHubURLFromTestPath(filepath) {
63+
generateGitHubURLFromTestPath(filepath, testName) {
6464
const result = /^Spec\/(.*)\.js\/[^:]*::(.*)*$/.exec(filepath);
6565
if (!result) return "";
66-
return `https://github.com/WebAssembly/testsuite/blob/main/${result[1]}.wast`;
66+
const lineNumber = /\(line (\d+)\)$/.exec(testName);
67+
const line = lineNumber ? `#L${lineNumber[1]}` : "";
68+
return `https://github.com/WebAssembly/testsuite/blob/main/${result[1]}.wast${line}`;
6769
},
6870
};
6971
</script>

0 commit comments

Comments
 (0)