@@ -583,6 +583,9 @@ private string expectationPattern() {
583
583
)
584
584
}
585
585
586
+ /** Gets the string `#select` or `problems`, which are equivalent result sets for a `problem` or `path-problem` query. */
587
+ private string mainResultSet ( ) { result = [ "#select" , "problems" ] }
588
+
586
589
/**
587
590
* Provides logic for creating a `@kind test-postprocess` query that checks
588
591
* inline test expectations using `$ Alert` markers.
@@ -650,8 +653,8 @@ module TestPostProcessing {
650
653
*/
651
654
private string getSourceTag ( int row ) {
652
655
getQueryKind ( ) = "path-problem" and
653
- exists ( string loc | queryResults ( "#select" , row , 2 , loc ) |
654
- if queryResults ( "#select" , row , 0 , loc ) then result = "Alert" else result = "Source"
656
+ exists ( string loc | queryResults ( mainResultSet ( ) , row , 2 , loc ) |
657
+ if queryResults ( mainResultSet ( ) , row , 0 , loc ) then result = "Alert" else result = "Source"
655
658
)
656
659
}
657
660
@@ -663,8 +666,8 @@ module TestPostProcessing {
663
666
*/
664
667
private string getSinkTag ( int row ) {
665
668
getQueryKind ( ) = "path-problem" and
666
- exists ( string loc | queryResults ( "#select" , row , 4 , loc ) |
667
- if queryResults ( "#select" , row , 0 , loc ) then result = "Alert" else result = "Sink"
669
+ exists ( string loc | queryResults ( mainResultSet ( ) , row , 4 , loc ) |
670
+ if queryResults ( mainResultSet ( ) , row , 0 , loc ) then result = "Alert" else result = "Sink"
668
671
)
669
672
}
670
673
@@ -717,8 +720,8 @@ module TestPostProcessing {
717
720
) {
718
721
getQueryKind ( ) = "path-problem" and
719
722
exists ( string loc |
720
- queryResults ( "#select" , row , 2 , loc ) and
721
- queryResults ( "#select" , row , 3 , element ) and
723
+ queryResults ( mainResultSet ( ) , row , 2 , loc ) and
724
+ queryResults ( mainResultSet ( ) , row , 3 , element ) and
722
725
tag = getSourceTag ( row ) and
723
726
value = "" and
724
727
Input2:: getRelativeUrl ( location ) = loc
@@ -757,8 +760,8 @@ module TestPostProcessing {
757
760
) {
758
761
getQueryKind ( ) = "path-problem" and
759
762
exists ( string loc |
760
- queryResults ( "#select" , row , 4 , loc ) and
761
- queryResults ( "#select" , row , 5 , element ) and
763
+ queryResults ( mainResultSet ( ) , row , 4 , loc ) and
764
+ queryResults ( mainResultSet ( ) , row , 5 , element ) and
762
765
tag = getSinkTag ( row ) and
763
766
Input2:: getRelativeUrl ( location ) = loc
764
767
)
@@ -767,8 +770,8 @@ module TestPostProcessing {
767
770
private predicate hasAlert ( int row , Input:: Location location , string element , string tag ) {
768
771
getQueryKind ( ) = [ "problem" , "path-problem" ] and
769
772
exists ( string loc |
770
- queryResults ( "#select" , row , 0 , loc ) and
771
- queryResults ( "#select" , row , 2 , element ) and
773
+ queryResults ( mainResultSet ( ) , row , 0 , loc ) and
774
+ queryResults ( mainResultSet ( ) , row , 2 , element ) and
772
775
tag = "Alert" and
773
776
Input2:: getRelativeUrl ( location ) = loc and
774
777
not hasPathProblemSource ( row , location , _, _, _) and
0 commit comments