@@ -171,43 +171,45 @@ module Make<InlineExpectationsTestSig Impl> {
171
171
*/
172
172
module MakeTest< TestSig TestImpl> {
173
173
private predicate hasFailureMessage ( FailureLocatable element , string message ) {
174
- exists ( ActualResult actualResult |
174
+ exists ( ActualTestResult actualResult |
175
175
actualResult .getTag ( ) = TestImpl:: getARelevantTag ( ) and
176
176
element = actualResult and
177
177
(
178
- exists ( FalseNegativeExpectation falseNegative |
178
+ exists ( FalseNegativeTestExpectation falseNegative |
179
179
falseNegative .matchesActualResult ( actualResult ) and
180
180
message = "Fixed missing result:" + falseNegative .getExpectationText ( )
181
181
)
182
182
or
183
- not exists ( ValidExpectation expectation | expectation .matchesActualResult ( actualResult ) ) and
183
+ not exists ( ValidTestExpectation expectation |
184
+ expectation .matchesActualResult ( actualResult )
185
+ ) and
184
186
message = "Unexpected result: " + actualResult .getExpectationText ( ) and
185
187
not actualResult .isOptional ( )
186
188
)
187
189
)
188
190
or
189
- exists ( ActualResult actualResult |
191
+ exists ( ActualTestResult actualResult |
190
192
not actualResult .getTag ( ) = TestImpl:: getARelevantTag ( ) and
191
193
element = actualResult and
192
194
message =
193
195
"Tag mismatch: Actual result with tag '" + actualResult .getTag ( ) +
194
196
"' that is not part of getARelevantTag()"
195
197
)
196
198
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
199
201
expectation .getTag ( ) = TestImpl:: getARelevantTag ( ) and
200
202
element = expectation and
201
203
(
202
- expectation instanceof GoodExpectation and
204
+ expectation instanceof GoodTestExpectation and
203
205
message = "Missing result:" + expectation .getExpectationText ( )
204
206
or
205
- expectation instanceof FalsePositiveExpectation and
207
+ expectation instanceof FalsePositiveTestExpectation and
206
208
message = "Fixed spurious result:" + expectation .getExpectationText ( )
207
209
)
208
210
)
209
211
or
210
- exists ( InvalidExpectation expectation |
212
+ exists ( InvalidTestExpectation expectation |
211
213
element = expectation and
212
214
message = "Invalid expectation syntax: " + expectation .getExpectation ( )
213
215
)
@@ -247,14 +249,14 @@ module Make<InlineExpectationsTestSig Impl> {
247
249
string getValue ( ) { none ( ) }
248
250
}
249
251
250
- class ActualResult extends FailureLocatable , TActualResult {
252
+ class ActualTestResult extends FailureLocatable , TActualResult {
251
253
Impl:: Location location ;
252
254
string element ;
253
255
string tag ;
254
256
string value ;
255
257
boolean optional ;
256
258
257
- ActualResult ( ) { this = TActualResult ( location , element , tag , value , optional ) }
259
+ ActualTestResult ( ) { this = TActualResult ( location , element , tag , value , optional ) }
258
260
259
261
override string toString ( ) { result = element }
260
262
@@ -275,7 +277,7 @@ module Make<InlineExpectationsTestSig Impl> {
275
277
override Impl:: Location getLocation ( ) { result = comment .getLocation ( ) }
276
278
}
277
279
278
- private predicate onSameLine ( ValidExpectation a , ActualResult b ) {
280
+ private predicate onSameLine ( ValidTestExpectation a , ActualTestResult b ) {
279
281
exists ( string fname , int line , Impl:: Location la , Impl:: Location lb |
280
282
// Join order intent:
281
283
// Take the locations of ActualResults,
@@ -288,43 +290,43 @@ module Make<InlineExpectationsTestSig Impl> {
288
290
)
289
291
}
290
292
291
- private class ValidExpectation extends Expectation , TValidExpectation {
293
+ private class ValidTestExpectation extends Expectation , TValidExpectation {
292
294
string tag ;
293
295
string value ;
294
296
string knownFailure ;
295
297
296
- ValidExpectation ( ) { this = TValidExpectation ( comment , tag , value , knownFailure ) }
298
+ ValidTestExpectation ( ) { this = TValidExpectation ( comment , tag , value , knownFailure ) }
297
299
298
300
override string getTag ( ) { result = tag }
299
301
300
302
override string getValue ( ) { result = value }
301
303
302
304
string getKnownFailure ( ) { result = knownFailure }
303
305
304
- predicate matchesActualResult ( ActualResult actualResult ) {
306
+ predicate matchesActualResult ( ActualTestResult actualResult ) {
305
307
onSameLine ( pragma [ only_bind_into ] ( this ) , actualResult ) and
306
308
this .getTag ( ) = actualResult .getTag ( ) and
307
309
this .getValue ( ) = actualResult .getValue ( )
308
310
}
309
311
}
310
312
311
313
// 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 ( ) = "" }
314
316
}
315
317
316
- class FalsePositiveExpectation extends ValidExpectation {
317
- FalsePositiveExpectation ( ) { this .getKnownFailure ( ) = "SPURIOUS" }
318
+ class FalsePositiveTestExpectation extends ValidTestExpectation {
319
+ FalsePositiveTestExpectation ( ) { this .getKnownFailure ( ) = "SPURIOUS" }
318
320
}
319
321
320
- class FalseNegativeExpectation extends ValidExpectation {
321
- FalseNegativeExpectation ( ) { this .getKnownFailure ( ) = "MISSING" }
322
+ class FalseNegativeTestExpectation extends ValidTestExpectation {
323
+ FalseNegativeTestExpectation ( ) { this .getKnownFailure ( ) = "MISSING" }
322
324
}
323
325
324
- class InvalidExpectation extends Expectation , TInvalidExpectation {
326
+ class InvalidTestExpectation extends Expectation , TInvalidExpectation {
325
327
string expectation ;
326
328
327
- InvalidExpectation ( ) { this = TInvalidExpectation ( comment , expectation ) }
329
+ InvalidTestExpectation ( ) { this = TInvalidExpectation ( comment , expectation ) }
328
330
329
331
string getExpectation ( ) { result = expectation }
330
332
}
@@ -432,6 +434,16 @@ module Make<InlineExpectationsTestSig Impl> {
432
434
import MakeTest< LegacyImpl > as LegacyTest
433
435
434
436
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 ;
435
447
}
436
448
437
449
/**
0 commit comments