@@ -56,8 +56,11 @@ extension Event {
5656 /// The instant at which the test started.
5757 var startInstant : Test . Clock . Instant
5858
59- /// The number of issues recorded for the test.
60- var issueCount = 0
59+ /// The number of issues with error severity recorded for the test.
60+ var errorIssueCount = 0
61+
62+ /// The number of issues with warning severity recorded for the test.
63+ var warningIssueCount = 0
6164
6265 /// The number of known issues recorded for the test.
6366 var knownIssueCount = 0
@@ -114,27 +117,36 @@ extension Event.HumanReadableOutputRecorder {
114117 /// - graph: The graph to walk while counting issues.
115118 ///
116119 /// - Returns: A tuple containing the number of issues recorded in `graph`.
117- private func _issueCounts( in graph: Graph < String , Event . HumanReadableOutputRecorder . _Context . TestData ? > ? ) -> ( issueCount : Int , knownIssueCount: Int , totalIssueCount: Int , description: String ) {
120+ private func _issueCounts( in graph: Graph < String , Event . HumanReadableOutputRecorder . _Context . TestData ? > ? ) -> ( errorIssueCount : Int , warningIssueCount : Int , knownIssueCount: Int , totalIssueCount: Int , description: String ) {
118121 guard let graph else {
119- return ( 0 , 0 , 0 , " " )
122+ return ( 0 , 0 , 0 , 0 , " " )
120123 }
121- let issueCount = graph. compactMap ( \. value? . issueCount) . reduce ( into: 0 , += )
124+ let errorIssueCount = graph. compactMap ( \. value? . errorIssueCount) . reduce ( into: 0 , += )
125+ let warningIssueCount = graph. compactMap ( \. value? . warningIssueCount) . reduce ( into: 0 , += )
122126 let knownIssueCount = graph. compactMap ( \. value? . knownIssueCount) . reduce ( into: 0 , += )
123- let totalIssueCount = issueCount + knownIssueCount
127+ let totalIssueCount = errorIssueCount + warningIssueCount + knownIssueCount
124128
125129 // Construct a string describing the issue counts.
126- let description = switch ( issueCount > 0 , knownIssueCount > 0 ) {
127- case ( true , true ) :
130+ let description = switch ( errorIssueCount > 0 , warningIssueCount > 0 , knownIssueCount > 0 ) {
131+ case ( true , true , true ) :
132+ " with \( totalIssueCount. counting ( " issue " ) ) (including \( warningIssueCount. counting ( " warning " ) ) and \( knownIssueCount. counting ( " known issue " ) ) ) "
133+ case ( true , false , true ) :
128134 " with \( totalIssueCount. counting ( " issue " ) ) (including \( knownIssueCount. counting ( " known issue " ) ) ) "
129- case ( false , true ) :
135+ case ( false , true , true ) :
136+ " with \( warningIssueCount. counting ( " warning " ) ) and \( knownIssueCount. counting ( " known issue " ) ) "
137+ case ( false , false , true ) :
130138 " with \( knownIssueCount. counting ( " known issue " ) ) "
131- case ( true , false ) :
139+ case ( true , true , false ) :
140+ " with \( totalIssueCount. counting ( " issue " ) ) (including \( warningIssueCount. counting ( " warning " ) ) ) "
141+ case ( true , false , false ) :
132142 " with \( totalIssueCount. counting ( " issue " ) ) "
133- case ( false , false ) :
143+ case ( false , true , false ) :
144+ " with \( warningIssueCount. counting ( " warning " ) ) "
145+ case ( false , false , false ) :
134146 " "
135147 }
136148
137- return ( issueCount , knownIssueCount, totalIssueCount, description)
149+ return ( errorIssueCount , warningIssueCount , knownIssueCount, totalIssueCount, description)
138150 }
139151}
140152
@@ -267,7 +279,12 @@ extension Event.HumanReadableOutputRecorder {
267279 if issue. isKnown {
268280 testData. knownIssueCount += 1
269281 } else {
270- testData. issueCount += 1
282+ switch issue. severity {
283+ case . warning:
284+ testData. warningIssueCount += 1
285+ case . error:
286+ testData. errorIssueCount += 1
287+ }
271288 }
272289 context. testData [ id] = testData
273290
@@ -355,15 +372,22 @@ extension Event.HumanReadableOutputRecorder {
355372 let testData = testDataGraph? . value ?? . init( startInstant: instant)
356373 let issues = _issueCounts ( in: testDataGraph)
357374 let duration = testData. startInstant. descriptionOfDuration ( to: instant)
358- return if issues. issueCount > 0 {
375+ return if issues. errorIssueCount > 0 {
359376 CollectionOfOne (
360377 Message (
361378 symbol: . fail,
362379 stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) failed after \( duration) \( issues. description) . "
363380 )
364381 ) + _formattedComments( for: test)
382+ } else if issues. warningIssueCount > 0 {
383+ [
384+ Message (
385+ symbol: . warning( warningIssueCount: issues. warningIssueCount) ,
386+ stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) passed after \( duration) \( issues. description) . "
387+ )
388+ ]
365389 } else {
366- [
390+ [
367391 Message (
368392 symbol: . pass( knownIssueCount: issues. knownIssueCount) ,
369393 stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) passed after \( duration) \( issues. description) . "
@@ -400,13 +424,19 @@ extension Event.HumanReadableOutputRecorder {
400424 " "
401425 }
402426 let symbol : Event . Symbol
403- let known : String
427+ let introducer : String
404428 if issue. isKnown {
405429 symbol = . pass( knownIssueCount: 1 )
406- known = " known "
430+ introducer = " a known"
407431 } else {
408- symbol = . fail
409- known = " n "
432+ switch issue. severity {
433+ case . warning:
434+ symbol = . warning( warningIssueCount: 1 )
435+ introducer = " a warning "
436+ case . error:
437+ symbol = . fail
438+ introducer = " an "
439+ }
410440 }
411441
412442 var additionalMessages = [ Message] ( )
@@ -435,13 +465,13 @@ extension Event.HumanReadableOutputRecorder {
435465 let primaryMessage : Message = if parameterCount == 0 {
436466 Message (
437467 symbol: symbol,
438- stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) recorded a \( known ) issue \( atSourceLocation) : \( issue. kind) " ,
468+ stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) recorded \( introducer ) issue \( atSourceLocation) : \( issue. kind) " ,
439469 conciseStringValue: String ( describing: issue. kind)
440470 )
441471 } else {
442472 Message (
443473 symbol: symbol,
444- stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) recorded a \( known ) issue with \( parameterCount. counting ( " argument " ) ) \( labeledArguments) \( atSourceLocation) : \( issue. kind) " ,
474+ stringValue: " \( _capitalizedTitle ( for: test) ) \( testName) recorded \( introducer ) issue with \( parameterCount. counting ( " argument " ) ) \( labeledArguments) \( atSourceLocation) : \( issue. kind) " ,
445475 conciseStringValue: String ( describing: issue. kind)
446476 )
447477 }
@@ -498,13 +528,20 @@ extension Event.HumanReadableOutputRecorder {
498528 let runStartInstant = context. runStartInstant ?? instant
499529 let duration = runStartInstant. descriptionOfDuration ( to: instant)
500530
501- return if issues. issueCount > 0 {
531+ return if issues. errorIssueCount > 0 {
502532 [
503533 Message (
504534 symbol: . fail,
505535 stringValue: " Test run with \( testCount. counting ( " test " ) ) failed after \( duration) \( issues. description) . "
506536 )
507537 ]
538+ } else if issues. warningIssueCount > 0 {
539+ [
540+ Message (
541+ symbol: . warning( warningIssueCount: issues. warningIssueCount) ,
542+ stringValue: " Test run with \( testCount. counting ( " test " ) ) passed after \( duration) \( issues. description) . "
543+ )
544+ ]
508545 } else {
509546 [
510547 Message (
0 commit comments