Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Testing/ABI/v0/ABIv0.Record+Streaming.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ extension ABIv0.Record {
eventHandler(testJSON)
}
} else {
let messages = humanReadableOutputRecorder.record(event, in: context)
let messages = humanReadableOutputRecorder.record(event, in: context, verbosity: 0)
if let eventRecord = Self(encoding: event, in: context, messages: messages) {
try? JSON.withEncoding(of: eventRecord, eventHandler)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,27 @@ extension Event.HumanReadableOutputRecorder {
/// - Parameters:
/// - event: The event to record.
/// - eventContext: The context associated with the event.
/// - verbosity: How verbose output should be. When the value of this
/// argument is greater than `0`, additional output is provided. When the
/// value of this argument is less than `0`, some output is suppressed.
/// If the value of this argument is `nil`, the value set for the current
/// configuration is used instead. The exact effects of this argument are
/// implementation-defined and subject to change.
///
/// - Returns: An array of zero or more messages that can be displayed to the
/// user.
@discardableResult public func record(_ event: borrowing Event, in eventContext: borrowing Event.Context) -> [Message] {
let verbosity = eventContext.configuration?.verbosity ?? 0
@discardableResult public func record(
_ event: borrowing Event,
in eventContext: borrowing Event.Context,
verbosity: Int? = nil
) -> [Message] {
let verbosity: Int = if let verbosity {
Copy link
Contributor Author

@grynspan grynspan Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't use the Elvis operator (??) with borrowed values (yet.)

verbosity
} else if let verbosity = eventContext.configuration?.verbosity {
verbosity
} else {
0
}
let test = eventContext.test
let testName = if let test {
if let displayName = test.displayName {
Expand Down Expand Up @@ -501,12 +517,3 @@ extension Event.HumanReadableOutputRecorder {
// MARK: - Codable

extension Event.HumanReadableOutputRecorder.Message: Codable {}

// MARK: - Deprecated

extension Event.HumanReadableOutputRecorder {
@available(*, deprecated, message: "Use record(_:in:) instead. Verbosity is now controlled by eventContext.configuration.verbosity.")
@discardableResult public func record(_ event: borrowing Event, in eventContext: borrowing Event.Context, verbosity: Int) -> [Message] {
record(event, in: eventContext)
}
}