mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
Swift codegen: add predicate properties
Properties marked with `predicate` in the schema are now accepted. * in the dbscheme, they will translate to a table with a single `id` column (and the table name will not be pluralized) * in C++ classes, they will translate to `bool` fields * in QL classes, they will translate to predicates Closes https://github.com/github/codeql-c-team/issues/1016
This commit is contained in:
@@ -92,6 +92,17 @@ def test_class_with_field(generate, type, expected, property_cls, optional, repe
|
||||
]
|
||||
|
||||
|
||||
def test_class_with_predicate(generate):
|
||||
assert generate([
|
||||
schema.Class(name="MyClass", properties=[schema.PredicateProperty("prop")]),
|
||||
]) == [
|
||||
cpp.Class(name="MyClass",
|
||||
fields=[cpp.Field("prop", "bool", trap_name="MyClassProp", is_predicate=True)],
|
||||
trap_name="MyClasses",
|
||||
final=True)
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name",
|
||||
["start_line", "start_column", "end_line", "end_column", "index", "num_whatever", "width"])
|
||||
def test_class_with_overridden_unsigned_field(generate, name):
|
||||
|
||||
Reference in New Issue
Block a user