Skip to content

Commit 0c47203

Browse files
committed
Javascript: Add support for pretty-printed provenace in tests.
1 parent 68ddae2 commit 0c47203

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,28 @@ private predicate typeVariableModel(string name, string path) {
369369
Extensions::typeVariableModel(name, path)
370370
}
371371

372+
/**
373+
* Holds if the given extension tuple `madId` should pretty-print as `model`.
374+
*
375+
* This predicate should only be used in tests.
376+
*/
377+
predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
378+
exists(string type, string path, string kind |
379+
Extensions::sourceModel(type, path, kind, madId) and
380+
model = "Source: " + type + "; " + path + "; " + kind
381+
)
382+
or
383+
exists(string type, string path, string kind |
384+
Extensions::sinkModel(type, path, kind, madId) and
385+
model = "Sink: " + type + "; " + path + "; " + kind
386+
)
387+
or
388+
exists(string type, string path, string input, string output, string kind |
389+
Extensions::summaryModel(type, path, input, output, kind, madId) and
390+
model = "Summary: " + type + "; " + path + "; " + input + "; " + output + "; " + kind
391+
)
392+
}
393+
372394
/**
373395
* Holds if rows involving `type` might be relevant for the analysis of this database.
374396
*/

0 commit comments

Comments
 (0)