Skip to content

Commit 7fddee9

Browse files
committed
Javascript: Add support for pretty-printed provenace in tests.
1 parent 272245a commit 7fddee9

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
@@ -303,6 +303,28 @@ private predicate typeVariableModel(string name, string path) {
303303
Extensions::typeVariableModel(name, path)
304304
}
305305

306+
/**
307+
* Holds if the given extension tuple `madId` should pretty-print as `model`.
308+
*
309+
* This predicate should only be used in tests.
310+
*/
311+
predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
312+
exists(string type, string path, string kind |
313+
Extensions::sourceModel(type, path, kind, madId) and
314+
model = "Source: " + type + "; " + path + "; " + kind
315+
)
316+
or
317+
exists(string type, string path, string kind |
318+
Extensions::sinkModel(type, path, kind, madId) and
319+
model = "Sink: " + type + "; " + path + "; " + kind
320+
)
321+
or
322+
exists(string type, string path, string input, string output, string kind |
323+
Extensions::summaryModel(type, path, input, output, kind, madId) and
324+
model = "Summary: " + type + "; " + path + "; " + input + "; " + output + "; " + kind
325+
)
326+
}
327+
306328
/**
307329
* Holds if CSV rows involving `type` might be relevant for the analysis of this database.
308330
*/

0 commit comments

Comments
 (0)