@@ -56,9 +56,8 @@ extension Event {
56
56
/// The instant at which the test started.
57
57
var startInstant : Test . Clock . Instant
58
58
59
- /// The number of issues recorded for the test, grouped by their
60
- /// level of severity.
61
- var issueCount : [ Issue . Severity : Int ] = [ : ]
59
+ /// The number of issues recorded for the test.
60
+ var issueCount = 0
62
61
63
62
/// The number of known issues recorded for the test.
64
63
var knownIssueCount = 0
@@ -115,36 +114,27 @@ extension Event.HumanReadableOutputRecorder {
115
114
/// - graph: The graph to walk while counting issues.
116
115
///
117
116
/// - Returns: A tuple containing the number of issues recorded in `graph`.
118
- private func _issueCounts( in graph: Graph < String , Event . HumanReadableOutputRecorder . _Context . TestData ? > ? ) -> ( errorIssueCount : Int , warningIssueCount : Int , knownIssueCount: Int , totalIssueCount: Int , description: String ) {
117
+ private func _issueCounts( in graph: Graph < String , Event . HumanReadableOutputRecorder . _Context . TestData ? > ? ) -> ( issueCount : Int , knownIssueCount: Int , totalIssueCount: Int , description: String ) {
119
118
guard let graph else {
120
- return ( 0 , 0 , 0 , 0 , " " )
119
+ return ( 0 , 0 , 0 , " " )
121
120
}
122
- let errorIssueCount = graph. compactMap ( \. value? . issueCount [ . error] ) . reduce ( into: 0 , += )
123
- let warningIssueCount = graph. compactMap ( \. value? . issueCount [ . warning] ) . reduce ( into: 0 , += )
121
+ let issueCount = graph. compactMap ( \. value? . issueCount) . reduce ( into: 0 , += )
124
122
let knownIssueCount = graph. compactMap ( \. value? . knownIssueCount) . reduce ( into: 0 , += )
125
- let totalIssueCount = errorIssueCount + warningIssueCount + knownIssueCount
123
+ let totalIssueCount = issueCount + knownIssueCount
126
124
127
125
// Construct a string describing the issue counts.
128
- let description = switch ( errorIssueCount > 0 , warningIssueCount > 0 , knownIssueCount > 0 ) {
129
- case ( true , true , true ) :
130
- " with \( totalIssueCount. counting ( " issue " ) ) (including \( warningIssueCount. counting ( " warning " ) ) and \( knownIssueCount. counting ( " known issue " ) ) ) "
131
- case ( true , false , true ) :
126
+ let description = switch ( issueCount > 0 , knownIssueCount > 0 ) {
127
+ case ( true , true ) :
132
128
" with \( totalIssueCount. counting ( " issue " ) ) (including \( knownIssueCount. counting ( " known issue " ) ) ) "
133
- case ( false , true , true ) :
134
- " with \( warningIssueCount. counting ( " warning " ) ) and \( knownIssueCount. counting ( " known issue " ) ) "
135
- case ( false , false , true ) :
129
+ case ( false , true ) :
136
130
" with \( knownIssueCount. counting ( " known issue " ) ) "
137
- case ( true , true , false ) :
138
- " with \( totalIssueCount. counting ( " issue " ) ) (including \( warningIssueCount. counting ( " warning " ) ) ) "
139
- case ( true , false , false ) :
131
+ case ( true , false ) :
140
132
" with \( totalIssueCount. counting ( " issue " ) ) "
141
- case ( false , true , false ) :
142
- " with \( warningIssueCount. counting ( " warning " ) ) "
143
- case ( false , false , false ) :
133
+ case ( false , false ) :
144
134
" "
145
135
}
146
136
147
- return ( errorIssueCount , warningIssueCount , knownIssueCount, totalIssueCount, description)
137
+ return ( issueCount , knownIssueCount, totalIssueCount, description)
148
138
}
149
139
}
150
140
@@ -277,8 +267,7 @@ extension Event.HumanReadableOutputRecorder {
277
267
if issue. isKnown {
278
268
testData. knownIssueCount += 1
279
269
} else {
280
- let issueCount = testData. issueCount [ issue. severity] ?? 0
281
- testData. issueCount [ issue. severity] = issueCount + 1
270
+ testData. issueCount += 1
282
271
}
283
272
context. testData [ id] = testData
284
273
@@ -366,15 +355,15 @@ extension Event.HumanReadableOutputRecorder {
366
355
let testData = testDataGraph? . value ?? . init( startInstant: instant)
367
356
let issues = _issueCounts ( in: testDataGraph)
368
357
let duration = testData. startInstant. descriptionOfDuration ( to: instant)
369
- return if issues. errorIssueCount > 0 {
358
+ return if issues. issueCount > 0 {
370
359
CollectionOfOne (
371
360
Message (
372
361
symbol: . fail,
373
362
stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) failed after \( duration) \( issues. description) . "
374
363
)
375
364
) + _formattedComments( for: test)
376
365
} else {
377
- [
366
+ [
378
367
Message (
379
368
symbol: . pass( knownIssueCount: issues. knownIssueCount) ,
380
369
stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) passed after \( duration) \( issues. description) . "
@@ -411,19 +400,13 @@ extension Event.HumanReadableOutputRecorder {
411
400
" "
412
401
}
413
402
let symbol : Event . Symbol
414
- let subject : String
403
+ let known : String
415
404
if issue. isKnown {
416
405
symbol = . pass( knownIssueCount: 1 )
417
- subject = " a known issue "
406
+ known = " known "
418
407
} else {
419
- switch issue. severity {
420
- case . warning:
421
- symbol = . passWithWarnings
422
- subject = " a warning "
423
- case . error:
424
- symbol = . fail
425
- subject = " an issue "
426
- }
408
+ symbol = . fail
409
+ known = " n "
427
410
}
428
411
429
412
var additionalMessages = [ Message] ( )
@@ -452,13 +435,13 @@ extension Event.HumanReadableOutputRecorder {
452
435
let primaryMessage : Message = if parameterCount == 0 {
453
436
Message (
454
437
symbol: symbol,
455
- stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) recorded \( subject ) \( atSourceLocation) : \( issue. kind) " ,
438
+ stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) recorded a \( known ) issue \( atSourceLocation) : \( issue. kind) " ,
456
439
conciseStringValue: String ( describing: issue. kind)
457
440
)
458
441
} else {
459
442
Message (
460
443
symbol: symbol,
461
- stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) recorded \( subject ) with \( parameterCount. counting ( " argument " ) ) \( labeledArguments) \( atSourceLocation) : \( issue. kind) " ,
444
+ stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) recorded a \( known ) issue with \( parameterCount. counting ( " argument " ) ) \( labeledArguments) \( atSourceLocation) : \( issue. kind) " ,
462
445
conciseStringValue: String ( describing: issue. kind)
463
446
)
464
447
}
@@ -515,7 +498,7 @@ extension Event.HumanReadableOutputRecorder {
515
498
let runStartInstant = context. runStartInstant ?? instant
516
499
let duration = runStartInstant. descriptionOfDuration ( to: instant)
517
500
518
- return if issues. errorIssueCount > 0 {
501
+ return if issues. issueCount > 0 {
519
502
[
520
503
Message (
521
504
symbol: . fail,
0 commit comments