@@ -93,26 +93,29 @@ class ResolutionTest extends InlineExpectationsTest {
93
93
}
94
94
}
95
95
96
- class ResolutionTest3 extends InlineExpectationsTest {
97
- ResolutionTest3 ( ) { this = "ResolutionTest3" }
96
+ private string getTagForVersion ( int version ) {
97
+ result = "prints" + version and
98
+ version = major_version ( )
99
+ }
100
+
101
+ class VersionSpecificResolutionTest extends InlineExpectationsTest {
102
+ VersionSpecificResolutionTest ( ) { this = "VersionSpecificResolutionTest" }
98
103
99
- override string getARelevantTag ( ) { result = "prints3" and major_version ( ) = 3 }
104
+ override string getARelevantTag ( ) { result = getTagForVersion ( _ ) }
100
105
101
106
override predicate hasActualResult ( Location location , string element , string tag , string value ) {
102
107
(
103
108
exists ( DataFlow:: PathNode source , DataFlow:: PathNode sink , ImportConfiguration config |
104
109
config .hasFlowPath ( source , sink ) and
105
- sink .getNode ( ) .( VersionGuardedNode ) .getVersion ( ) = 3 and
106
- tag = "prints3" and
110
+ tag = getTagForVersion ( sink .getNode ( ) .( VersionGuardedNode ) .getVersion ( ) ) and
107
111
location = sink .getNode ( ) .getLocation ( ) and
108
112
value = source .getNode ( ) .( SourceString ) .getContents ( ) and
109
113
element = sink .getNode ( ) .toString ( )
110
114
)
111
115
or
112
116
exists ( ModuleRef ref |
113
- ref .( VersionGuardedNode ) .getVersion ( ) = 3 and
114
117
ref instanceof CheckArgument and
115
- tag = "prints3" and
118
+ tag = getTagForVersion ( ref . ( VersionGuardedNode ) . getVersion ( ) ) and
116
119
location = ref .getLocation ( ) and
117
120
value = "\"<module " + ref .getName ( ) + ">\"" and
118
121
element = ref .toString ( )
0 commit comments