Files
codeql/misc/codegen/templates/ql_test_class.mustache
Paolo Tranquilli 6bbf1e3bc1 Codegen: use one generated test file per directory
This collapses all generated test QL sources into a single one per
directory, using query predicates to run the different tests.

This should improve the time required to run generated tests.
2025-06-25 11:44:54 +02:00

31 lines
1.0 KiB
Plaintext

// generated by {{generator}}, do not edit
import {{elements_module}}
import TestUtils
query predicate instances({{class_name}} x{{#show_ql_class}}, string primaryQlClasses{{/show_ql_class}}{{#properties}}{{#is_total}}, string {{getter}}__label, {{#type}}{{.}}{{/type}}{{^type}}string{{/type}} {{getter}}{{/is_total}}{{/properties}}) {
toBeTested(x) and not x.isUnknown()
{{#show_ql_class}}
and primaryQlClasses = x.getPrimaryQlClasses()
{{/show_ql_class}}
{{#properties}}
{{#is_total}}
and {{getter}}__label = "{{getter}}:"
{{#type}}
and {{getter}} = x.{{getter}}()
{{/type}}
{{^type}}
and if x.{{getter}}() then {{getter}} = "yes" else {{getter}} = "no"
{{/type}}
{{/is_total}}
{{/properties}}
}
{{#properties}}
{{^is_total}}
query predicate {{getter}}({{class_name}} x{{#is_indexed}}, int index{{/is_indexed}}, {{type}} {{getter}}) {
toBeTested(x) and not x.isUnknown() and {{getter}} = x.{{getter}}({{#is_indexed}}index{{/is_indexed}})
}
{{/is_total}}
{{/properties}}