@@ -356,6 +356,40 @@ module Make<InlineExpectationsTestSig Impl> {
356
356
else value = ""
357
357
}
358
358
359
+ /**
360
+ * A module that merges two test signatures.
361
+ *
362
+ * This module can be used when multiple inline expectation tests occur in a single file. For example:
363
+ * ```ql
364
+ * module Test1 implements TestSig {
365
+ * ...
366
+ * }
367
+ *
368
+ * module Test2 implements TestSig {
369
+ * ...
370
+ * }
371
+ *
372
+ * import MakeTest<MergeTests<Test1, Test2>>
373
+ * ```
374
+ */
375
+ module MergeTests< TestSig TestImpl1, TestSig TestImpl2> implements TestSig {
376
+ string getARelevantTag ( ) {
377
+ result = TestImpl1:: getARelevantTag ( ) or result = TestImpl2:: getARelevantTag ( )
378
+ }
379
+
380
+ predicate hasActualResult ( Impl:: Location location , string element , string tag , string value ) {
381
+ TestImpl1:: hasActualResult ( location , element , tag , value )
382
+ or
383
+ TestImpl2:: hasActualResult ( location , element , tag , value )
384
+ }
385
+
386
+ predicate hasOptionalResult ( Impl:: Location location , string element , string tag , string value ) {
387
+ TestImpl1:: hasOptionalResult ( location , element , tag , value )
388
+ or
389
+ TestImpl2:: hasOptionalResult ( location , element , tag , value )
390
+ }
391
+ }
392
+
359
393
private module LegacyImpl implements TestSig {
360
394
string getARelevantTag ( ) { result = any ( InlineExpectationsTest t ) .getARelevantTag ( ) }
361
395
0 commit comments