Swift: show QL class in generated tests on collapsed hierarchies

In those kinds of tests the results may have different final classes
that are not necessarily visible (or tested) solely through the string
representation. For better testing and reading of expected results,
`getQlPrimaryClasses` is added in these cases.
This commit is contained in:
Paolo Tranquilli
2022-10-17 14:01:33 +02:00
parent c3968a2166
commit e49268d036
10 changed files with 27 additions and 23 deletions

View File

@@ -304,7 +304,10 @@ def generate(opts, renderer):
total_props, partial_props = _partition(_get_all_properties_to_be_tested(c, data.classes),
lambda p: p.is_single or p.is_predicate)
renderer.render(ql.ClassTester(class_name=c.name,
properties=total_props), test_dir / f"{c.name}.ql")
properties=total_props,
# in case of collapsed hierarchies we want to see the actual QL class in results
show_ql_class="qltest_collapse_hierarchy" in c.pragmas),
test_dir / f"{c.name}.ql")
for p in partial_props:
renderer.render(ql.PropertyTester(class_name=c.name,
property=p), test_dir / f"{c.name}_{p.getter}.ql")