@@ -93,26 +93,29 @@ class ResolutionTest extends InlineExpectationsTest {
9393 }
9494}
9595
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" }
98103
99- override string getARelevantTag ( ) { result = "prints3" and major_version ( ) = 3 }
104+ override string getARelevantTag ( ) { result = getTagForVersion ( _ ) }
100105
101106 override predicate hasActualResult ( Location location , string element , string tag , string value ) {
102107 (
103108 exists ( DataFlow:: PathNode source , DataFlow:: PathNode sink , ImportConfiguration config |
104109 config .hasFlowPath ( source , sink ) and
105- sink .getNode ( ) .( VersionGuardedNode ) .getVersion ( ) = 3 and
106- tag = "prints3" and
110+ tag = getTagForVersion ( sink .getNode ( ) .( VersionGuardedNode ) .getVersion ( ) ) and
107111 location = sink .getNode ( ) .getLocation ( ) and
108112 value = source .getNode ( ) .( SourceString ) .getContents ( ) and
109113 element = sink .getNode ( ) .toString ( )
110114 )
111115 or
112116 exists ( ModuleRef ref |
113- ref .( VersionGuardedNode ) .getVersion ( ) = 3 and
114117 ref instanceof CheckArgument and
115- tag = "prints3" and
118+ tag = getTagForVersion ( ref . ( VersionGuardedNode ) . getVersion ( ) ) and
116119 location = ref .getLocation ( ) and
117120 value = "\"<module " + ref .getName ( ) + ">\"" and
118121 element = ref .toString ( )
0 commit comments