@@ -25,14 +25,32 @@ def __init__(self, options):
25
25
super (TestReport , self ).__init__ (options )
26
26
self ._verbose = options .verbose
27
27
28
+ def error (self , line_number , offset , text , check ):
29
+ """Report an error, according to options."""
30
+ code = text [:4 ]
31
+ if code in self .counters :
32
+ self .counters [code ] += 1
33
+ else :
34
+ self .counters [code ] = 1
35
+ detailed_code = '%s:%s:%s' % (code , line_number , offset + 1 )
36
+ # Don't care about expected errors or warnings
37
+ if code in self .expected or detailed_code in self .expected :
38
+ return
39
+ self ._deferred_print .append (
40
+ (line_number , offset , detailed_code , text [5 :], check .__doc__ ))
41
+ self .file_errors += 1
42
+ self .total_errors += 1
43
+ return code
44
+
28
45
def get_file_results (self ):
29
46
# Check if the expected errors were found
30
47
label = '%s:%s:1' % (self .filename , self .line_offset )
31
- for code in self .expected :
48
+ for extended_code in self .expected :
49
+ code = extended_code .split (':' )[0 ]
32
50
if not self .counters .get (code ):
33
51
self .file_errors += 1
34
52
self .total_errors += 1
35
- print ('%s: error %s not found' % (label , code ))
53
+ print ('%s: error %s not found' % (label , extended_code ))
36
54
else :
37
55
self .counters [code ] -= 1
38
56
for code , extra in sorted (self .counters .items ()):
@@ -50,7 +68,6 @@ def get_file_results(self):
50
68
self .counters ['test cases' ] += 1
51
69
if self .file_errors :
52
70
self .counters ['failed tests' ] += 1
53
- self .messages = {}
54
71
return super (TestReport , self ).get_file_results ()
55
72
56
73
def print_results (self ):
@@ -93,7 +110,6 @@ def selftest(options):
93
110
# Keep showing errors for multiple tests
94
111
for key in set (counters ) - set (options .benchmark_keys ):
95
112
del counters [key ]
96
- report .messages = {}
97
113
count_all += 1
98
114
if not error :
99
115
if options .verbose :
0 commit comments