@@ -171,43 +171,45 @@ module Make<InlineExpectationsTestSig Impl> {
171171 */
172172 module MakeTest< TestSig TestImpl> {
173173 private predicate hasFailureMessage ( FailureLocatable element , string message ) {
174- exists ( ActualResult actualResult |
174+ exists ( ActualTestResult actualResult |
175175 actualResult .getTag ( ) = TestImpl:: getARelevantTag ( ) and
176176 element = actualResult and
177177 (
178- exists ( FalseNegativeExpectation falseNegative |
178+ exists ( FalseNegativeTestExpectation falseNegative |
179179 falseNegative .matchesActualResult ( actualResult ) and
180180 message = "Fixed missing result:" + falseNegative .getExpectationText ( )
181181 )
182182 or
183- not exists ( ValidExpectation expectation | expectation .matchesActualResult ( actualResult ) ) and
183+ not exists ( ValidTestExpectation expectation |
184+ expectation .matchesActualResult ( actualResult )
185+ ) and
184186 message = "Unexpected result: " + actualResult .getExpectationText ( ) and
185187 not actualResult .isOptional ( )
186188 )
187189 )
188190 or
189- exists ( ActualResult actualResult |
191+ exists ( ActualTestResult actualResult |
190192 not actualResult .getTag ( ) = TestImpl:: getARelevantTag ( ) and
191193 element = actualResult and
192194 message =
193195 "Tag mismatch: Actual result with tag '" + actualResult .getTag ( ) +
194196 "' that is not part of getARelevantTag()"
195197 )
196198 or
197- exists ( ValidExpectation expectation |
198- not exists ( ActualResult actualResult | expectation .matchesActualResult ( actualResult ) ) and
199+ exists ( ValidTestExpectation expectation |
200+ not exists ( ActualTestResult actualResult | expectation .matchesActualResult ( actualResult ) ) and
199201 expectation .getTag ( ) = TestImpl:: getARelevantTag ( ) and
200202 element = expectation and
201203 (
202- expectation instanceof GoodExpectation and
204+ expectation instanceof GoodTestExpectation and
203205 message = "Missing result:" + expectation .getExpectationText ( )
204206 or
205- expectation instanceof FalsePositiveExpectation and
207+ expectation instanceof FalsePositiveTestExpectation and
206208 message = "Fixed spurious result:" + expectation .getExpectationText ( )
207209 )
208210 )
209211 or
210- exists ( InvalidExpectation expectation |
212+ exists ( InvalidTestExpectation expectation |
211213 element = expectation and
212214 message = "Invalid expectation syntax: " + expectation .getExpectation ( )
213215 )
@@ -247,14 +249,14 @@ module Make<InlineExpectationsTestSig Impl> {
247249 string getValue ( ) { none ( ) }
248250 }
249251
250- class ActualResult extends FailureLocatable , TActualResult {
252+ class ActualTestResult extends FailureLocatable , TActualResult {
251253 Impl:: Location location ;
252254 string element ;
253255 string tag ;
254256 string value ;
255257 boolean optional ;
256258
257- ActualResult ( ) { this = TActualResult ( location , element , tag , value , optional ) }
259+ ActualTestResult ( ) { this = TActualResult ( location , element , tag , value , optional ) }
258260
259261 override string toString ( ) { result = element }
260262
@@ -275,7 +277,7 @@ module Make<InlineExpectationsTestSig Impl> {
275277 override Impl:: Location getLocation ( ) { result = comment .getLocation ( ) }
276278 }
277279
278- private predicate onSameLine ( ValidExpectation a , ActualResult b ) {
280+ private predicate onSameLine ( ValidTestExpectation a , ActualTestResult b ) {
279281 exists ( string fname , int line , Impl:: Location la , Impl:: Location lb |
280282 // Join order intent:
281283 // Take the locations of ActualResults,
@@ -288,43 +290,43 @@ module Make<InlineExpectationsTestSig Impl> {
288290 )
289291 }
290292
291- private class ValidExpectation extends Expectation , TValidExpectation {
293+ private class ValidTestExpectation extends Expectation , TValidExpectation {
292294 string tag ;
293295 string value ;
294296 string knownFailure ;
295297
296- ValidExpectation ( ) { this = TValidExpectation ( comment , tag , value , knownFailure ) }
298+ ValidTestExpectation ( ) { this = TValidExpectation ( comment , tag , value , knownFailure ) }
297299
298300 override string getTag ( ) { result = tag }
299301
300302 override string getValue ( ) { result = value }
301303
302304 string getKnownFailure ( ) { result = knownFailure }
303305
304- predicate matchesActualResult ( ActualResult actualResult ) {
306+ predicate matchesActualResult ( ActualTestResult actualResult ) {
305307 onSameLine ( pragma [ only_bind_into ] ( this ) , actualResult ) and
306308 this .getTag ( ) = actualResult .getTag ( ) and
307309 this .getValue ( ) = actualResult .getValue ( )
308310 }
309311 }
310312
311313 // Note: These next three classes correspond to all the possible values of type `TColumn`.
312- class GoodExpectation extends ValidExpectation {
313- GoodExpectation ( ) { this .getKnownFailure ( ) = "" }
314+ class GoodTestExpectation extends ValidTestExpectation {
315+ GoodTestExpectation ( ) { this .getKnownFailure ( ) = "" }
314316 }
315317
316- class FalsePositiveExpectation extends ValidExpectation {
317- FalsePositiveExpectation ( ) { this .getKnownFailure ( ) = "SPURIOUS" }
318+ class FalsePositiveTestExpectation extends ValidTestExpectation {
319+ FalsePositiveTestExpectation ( ) { this .getKnownFailure ( ) = "SPURIOUS" }
318320 }
319321
320- class FalseNegativeExpectation extends ValidExpectation {
321- FalseNegativeExpectation ( ) { this .getKnownFailure ( ) = "MISSING" }
322+ class FalseNegativeTestExpectation extends ValidTestExpectation {
323+ FalseNegativeTestExpectation ( ) { this .getKnownFailure ( ) = "MISSING" }
322324 }
323325
324- class InvalidExpectation extends Expectation , TInvalidExpectation {
326+ class InvalidTestExpectation extends Expectation , TInvalidExpectation {
325327 string expectation ;
326328
327- InvalidExpectation ( ) { this = TInvalidExpectation ( comment , expectation ) }
329+ InvalidTestExpectation ( ) { this = TInvalidExpectation ( comment , expectation ) }
328330
329331 string getExpectation ( ) { result = expectation }
330332 }
@@ -432,6 +434,16 @@ module Make<InlineExpectationsTestSig Impl> {
432434 import MakeTest< LegacyImpl > as LegacyTest
433435
434436 query predicate failures = LegacyTest:: testFailures / 2 ;
437+
438+ class ActualResult = LegacyTest:: ActualTestResult ;
439+
440+ class GoodExpectation = LegacyTest:: GoodTestExpectation ;
441+
442+ class FalsePositiveExpectation = LegacyTest:: FalsePositiveTestExpectation ;
443+
444+ class FalseNegativeExpectation = LegacyTest:: FalseNegativeTestExpectation ;
445+
446+ class InvalidExpectation = LegacyTest:: InvalidTestExpectation ;
435447}
436448
437449/**
0 commit comments