Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QtM test/chaff identification fixes #56

Open
wants to merge 2 commits into
base: 2023
Choose a base branch
from
Open
Changes from all commits
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
14 changes: 13 additions & 1 deletion src/web/js/check-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@
function isTestResult(val) { return runtime.unwrap(runtime.getField(CH, "TestResult").app(val)); }
function isTestSuccess(val) { return runtime.unwrap(runtime.getField(CH, "is-success").app(val)); }

function getAllLines(doc) {
if (doc.lines === undefined) {
return doc.children.map(getAllLines).reduce((acc, val) => acc.concat(val), []);
} else {
return doc.lines;
}
}

function getStrFromLocObj(l) {
const name = JSON.parse(l.str);
const startLine = name[1].line;
const startChar = name[1].ch;
const endLine = name[2].line;
const endChar = name[2].ch;

const fileLines = l.doc.children.map(c => c.lines).reduce((acc, val) => acc.concat(val), []);
const fileLines = getAllLines(l.doc);

if (startLine == endLine) {
return fileLines[startLine].text.substring(startChar, endChar);
Expand Down Expand Up @@ -81,6 +89,10 @@
return testedFuncHasSuffix(testAsStr, QTM_IN_SUFFIX) || testedFuncHasSuffix(testAsStr, QTM_OUT_SUFFIX);
}
function isQtmChaff(cb_array) {
// TODO @eerivera: Need to figure out why this typecheck can sometimes fail.
if (!Array.isArray(cb_array) || cb_array.length == 0 || !cb_array[0].filename) {
return false;
}
let name = cb_array[0].filename;
return name.includes(QTM_IN_SUFFIX) || name.includes(QTM_OUT_SUFFIX);
}
Expand Down