@@ -56,9 +56,8 @@ 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, 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
6261
6362 /// The number of known issues recorded for the test.
6463 var knownIssueCount = 0
@@ -115,36 +114,27 @@ extension Event.HumanReadableOutputRecorder {
115114 /// - graph: The graph to walk while counting issues.
116115 ///
117116 /// - 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) {
119118 guard let graph else {
120- return (0, 0, 0, 0, "")
119+ return (0, 0, 0, "")
121120 }
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, +=)
124122 let knownIssueCount = graph.compactMap(\.value?.knownIssueCount).reduce(into: 0, +=)
125- let totalIssueCount = errorIssueCount + warningIssueCount + knownIssueCount
123+ let totalIssueCount = issueCount + knownIssueCount
126124
127125 // 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):
132128 " 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):
136130 " 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):
140132 " with \(totalIssueCount.counting("issue"))"
141- case(false, true, false):
142- " with \(warningIssueCount.counting("warning"))"
143- case(false, false, false):
133+ case(false, false):
144134 ""
145135 }
146136
147- return (errorIssueCount, warningIssueCount , knownIssueCount, totalIssueCount, description)
137+ return (issueCount , knownIssueCount, totalIssueCount, description)
148138 }
149139}
150140
@@ -277,8 +267,7 @@ extension Event.HumanReadableOutputRecorder {
277267 if issue.isKnown {
278268 testData.knownIssueCount += 1
279269 } else {
280- let issueCount = testData.issueCount[issue.severity] ?? 0
281- testData.issueCount[issue.severity] = issueCount + 1
270+ testData.issueCount += 1
282271 }
283272 context.testData[id] = testData
284273
@@ -366,15 +355,15 @@ extension Event.HumanReadableOutputRecorder {
366355 let testData = testDataGraph?.value ?? .init(startInstant: instant)
367356 let issues = _issueCounts(in: testDataGraph)
368357 let duration = testData.startInstant.descriptionOfDuration(to: instant)
369- return if issues.errorIssueCount > 0 {
358+ return if issues.issueCount > 0 {
370359 CollectionOfOne(
371360 Message(
372361 symbol: .fail,
373362 stringValue: "\(_capitalizedTitle(for: test)) \(testName) failed after \(duration)\(issues.description)."
374363 )
375364 ) + _formattedComments(for: test)
376365 } else {
377- [
366+ [
378367 Message(
379368 symbol: .pass(knownIssueCount: issues.knownIssueCount),
380369 stringValue: "\(_capitalizedTitle(for: test)) \(testName) passed after \(duration)\(issues.description)."
@@ -411,19 +400,13 @@ extension Event.HumanReadableOutputRecorder {
411400 ""
412401 }
413402 let symbol: Event.Symbol
414- let subject : String
403+ let known : String
415404 if issue.isKnown {
416405 symbol = .pass(knownIssueCount: 1)
417- subject = "a known issue "
406+ known = " known"
418407 } 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"
427410 }
428411
429412 var additionalMessages = [Message]()
@@ -452,13 +435,13 @@ extension Event.HumanReadableOutputRecorder {
452435 let primaryMessage: Message = if parameterCount == 0 {
453436 Message(
454437 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)",
456439 conciseStringValue: String(describing: issue.kind)
457440 )
458441 } else {
459442 Message(
460443 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)",
462445 conciseStringValue: String(describing: issue.kind)
463446 )
464447 }
@@ -515,7 +498,7 @@ extension Event.HumanReadableOutputRecorder {
515498 let runStartInstant = context.runStartInstant ?? instant
516499 let duration = runStartInstant.descriptionOfDuration(to: instant)
517500
518- return if issues.errorIssueCount > 0 {
501+ return if issues.issueCount > 0 {
519502 [
520503 Message(
521504 symbol: .fail,
0 commit comments