@@ -101,7 +101,7 @@ def _filter_generated_classes(ret, output_test_files=False):
101
101
str (f ): ret [ql_test_output_path () / f ]
102
102
for f in test_files
103
103
}
104
- base_files -= {pathlib .Path ("IpaTypes .qll" ), pathlib . Path ( " IpaConstructors.qll " )}
104
+ base_files -= {pathlib .Path (f" { name } .qll" ) for name in ( "Db" , "IpaTypes" , " IpaConstructors" )}
105
105
assert stub_files == base_files
106
106
return {
107
107
str (f ): (ret [stub_path () / f ], ret [ql_output_path () / f ])
@@ -131,6 +131,8 @@ def test_empty(generate):
131
131
children_file (): ql .GetParentImplementation (),
132
132
ql_output_path () / "IpaTypes.qll" : ql .Ipa .Types (schema .root_class_name ),
133
133
ql_output_path () / "IpaConstructors.qll" : ql .ImportList (),
134
+ ql_output_path () / "Db.qll" : ql .DbClasses (),
135
+ ql_output_path () / "Db.qll" : ql .DbClasses (),
134
136
}
135
137
136
138
@@ -139,7 +141,7 @@ def test_one_empty_class(generate_classes):
139
141
schema .Class ("A" )
140
142
]) == {
141
143
"A.qll" : (ql .Stub (name = "A" , base_import = gen_import_prefix + "A" ),
142
- ql .Class (name = "A" , final = True , fields = [ ql . Field ( 'id' , type = '@a' )] )),
144
+ ql .Class (name = "A" , final = True )),
143
145
}
144
146
145
147
@@ -157,7 +159,7 @@ def test_hierarchy(generate_classes):
157
159
"C.qll" : (ql .Stub (name = "C" , base_import = gen_import_prefix + "C" ),
158
160
ql .Class (name = "C" , bases = ["A" ], imports = [stub_import_prefix + "A" ])),
159
161
"D.qll" : (ql .Stub (name = "D" , base_import = gen_import_prefix + "D" ),
160
- ql .Class (name = "D" , final = True , bases = ["B" , "C" ], fields = [ ql . Field ( "id" , type = "@d" )],
162
+ ql .Class (name = "D" , final = True , bases = ["B" , "C" ],
161
163
imports = [stub_import_prefix + cls for cls in "BC" ])),
162
164
}
163
165
@@ -183,7 +185,7 @@ def test_hierarchy_children(generate_children_implementations):
183
185
stub_import_prefix + "A" ]),
184
186
ql .Class (name = "C" , bases = ["A" ], imports = [
185
187
stub_import_prefix + "A" ]),
186
- ql .Class (name = "D" , final = True , bases = ["B" , "C" ], fields = [ ql . Field ( "id" , type = "@d" )],
188
+ ql .Class (name = "D" , final = True , bases = ["B" , "C" ],
187
189
imports = [stub_import_prefix + cls for cls in "BC" ]),
188
190
],
189
191
)
@@ -195,10 +197,10 @@ def test_single_property(generate_classes):
195
197
schema .SingleProperty ("foo" , "bar" )]),
196
198
]) == {
197
199
"MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
198
- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )],
200
+ ql .Class (name = "MyObject" , final = True ,
199
201
properties = [
200
202
ql .Property (singular = "Foo" , type = "bar" , tablename = "my_objects" ,
201
- tableparams = ["id " , "result" ]),
203
+ tableparams = ["this " , "result" ]),
202
204
])),
203
205
}
204
206
@@ -212,14 +214,14 @@ def test_single_properties(generate_classes):
212
214
]),
213
215
]) == {
214
216
"MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
215
- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )],
217
+ ql .Class (name = "MyObject" , final = True ,
216
218
properties = [
217
219
ql .Property (singular = "One" , type = "x" , tablename = "my_objects" ,
218
- tableparams = ["id " , "result" , "_" , "_" ]),
220
+ tableparams = ["this " , "result" , "_" , "_" ]),
219
221
ql .Property (singular = "Two" , type = "y" , tablename = "my_objects" ,
220
- tableparams = ["id " , "_" , "result" , "_" ]),
222
+ tableparams = ["this " , "_" , "result" , "_" ]),
221
223
ql .Property (singular = "Three" , type = "z" , tablename = "my_objects" ,
222
- tableparams = ["id " , "_" , "_" , "result" ]),
224
+ tableparams = ["this " , "_" , "_" , "result" ]),
223
225
])),
224
226
}
225
227
@@ -231,9 +233,9 @@ def test_optional_property(generate_classes, is_child):
231
233
schema .OptionalProperty ("foo" , "bar" , is_child = is_child )]),
232
234
]) == {
233
235
"MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
234
- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )], properties = [
236
+ ql .Class (name = "MyObject" , final = True , properties = [
235
237
ql .Property (singular = "Foo" , type = "bar" , tablename = "my_object_foos" ,
236
- tableparams = ["id " , "result" ],
238
+ tableparams = ["this " , "result" ],
237
239
is_optional = True , is_child = is_child ),
238
240
])),
239
241
}
@@ -246,9 +248,9 @@ def test_repeated_property(generate_classes, is_child):
246
248
schema .RepeatedProperty ("foo" , "bar" , is_child = is_child )]),
247
249
]) == {
248
250
"MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
249
- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )], properties = [
251
+ ql .Class (name = "MyObject" , final = True , properties = [
250
252
ql .Property (singular = "Foo" , plural = "Foos" , type = "bar" , tablename = "my_object_foos" ,
251
- tableparams = ["id " , "index" , "result" ], is_child = is_child ),
253
+ tableparams = ["this " , "index" , "result" ], is_child = is_child ),
252
254
])),
253
255
}
254
256
@@ -260,9 +262,9 @@ def test_repeated_optional_property(generate_classes, is_child):
260
262
schema .RepeatedOptionalProperty ("foo" , "bar" , is_child = is_child )]),
261
263
]) == {
262
264
"MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
263
- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )], properties = [
265
+ ql .Class (name = "MyObject" , final = True , properties = [
264
266
ql .Property (singular = "Foo" , plural = "Foos" , type = "bar" , tablename = "my_object_foos" ,
265
- tableparams = ["id " , "index" , "result" ], is_optional = True ,
267
+ tableparams = ["this " , "index" , "result" ], is_optional = True ,
266
268
is_child = is_child ),
267
269
])),
268
270
}
@@ -274,9 +276,9 @@ def test_predicate_property(generate_classes):
274
276
schema .PredicateProperty ("is_foo" )]),
275
277
]) == {
276
278
"MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
277
- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )], properties = [
279
+ ql .Class (name = "MyObject" , final = True , properties = [
278
280
ql .Property (singular = "isFoo" , type = "predicate" , tablename = "my_object_is_foo" ,
279
- tableparams = ["id " ],
281
+ tableparams = ["this " ],
280
282
is_predicate = True ),
281
283
])),
282
284
}
@@ -291,15 +293,15 @@ def test_single_class_property(generate_classes, is_child):
291
293
]) == {
292
294
"MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
293
295
ql .Class (
294
- name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )], imports = [stub_import_prefix + "Bar" ], properties = [
296
+ name = "MyObject" , final = True , imports = [stub_import_prefix + "Bar" ], properties = [
295
297
ql .Property (singular = "Foo" , type = "Bar" , tablename = "my_objects" ,
296
298
tableparams = [
297
- "id " , "result" ],
299
+ "this " , "result" ],
298
300
is_child = is_child ),
299
301
],
300
302
)),
301
303
"Bar.qll" : (ql .Stub (name = "Bar" , base_import = gen_import_prefix + "Bar" ),
302
- ql .Class (name = "Bar" , final = True , fields = [ ql . Field ( "id" , type = "@bar" )] )),
304
+ ql .Class (name = "Bar" , final = True )),
303
305
}
304
306
305
307
@@ -312,7 +314,7 @@ def test_class_dir(generate_classes):
312
314
f"{ dir } /A.qll" : (ql .Stub (name = "A" , base_import = gen_import_prefix + "another.rel.path.A" ),
313
315
ql .Class (name = "A" , dir = dir )),
314
316
"B.qll" : (ql .Stub (name = "B" , base_import = gen_import_prefix + "B" ),
315
- ql .Class (name = "B" , final = True , fields = [ ql . Field ( "id" , type = "@b" )], bases = ["A" ],
317
+ ql .Class (name = "B" , final = True , bases = ["A" ],
316
318
imports = [stub_import_prefix + "another.rel.path.A" ])),
317
319
}
318
320
0 commit comments