Skip to content

Commit 25fb01c

Browse files
authored
Accept arbitrary strings in Swift Testing event stream version options (#8944)
This modifies the `swift test` command line `@Option` properties which represent a Swift Testing event stream version (primarily `--event-stream-version <...>`) to accept arbitrary `String` arguments. ### Motivation: In Swift Testing we are moving towards making the entry point and event stream versions aligned with the Swift version, rather than having an independent versioning scheme which users must look up or keep track of. Once this and other work lands, this means that in order to use the event stream format included in (for example) Swift 6.2, a user would pass `--event-stream-version 6.2`. However, until now these CLI options have required an integer argument like `--event-stream-version 0`. This change relaxes this requirement so that any arbitrary string will be accepted. In a separate PR, the Swift Testing library will perform additional validation of the format of this string to ensure it's valid, but we will need to continue accepting the current integers (e.g. `0`) in addition to newer Swift versions (e.g. `6.2`, `6.3`, …) going forward. ### Modifications: - Replace `Int?` type of these options with `String?`. - Update the documentation. ### Result: In local testing, I'm able to pass any string argument now.
1 parent 6e3f087 commit 25fb01c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Sources/Commands/SwiftTestCommand.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,18 @@ struct TestEventStreamOptions: ParsableArguments {
111111
help: .hidden)
112112
var eventStreamOutputPath: AbsolutePath?
113113

114-
/// Legacy equivalent of ``eventStreamVersion``.
114+
/// The experimental version number of Swift Testing's event stream to use.
115+
///
116+
/// Unlike ``eventStreamVersion``, this permits specifying a version which
117+
/// is experimental.
115118
@Option(name: .customLong("experimental-event-stream-version"),
116119
help: .private)
117-
var experimentalEventStreamVersion: Int?
120+
var experimentalEventStreamVersion: String?
118121

119-
/// The schema version of swift-testing's JSON input/output.
122+
/// The version number of Swift Testing's event stream to use.
120123
@Option(name: .customLong("event-stream-version"),
121124
help: .hidden)
122-
var eventStreamVersion: Int?
125+
var eventStreamVersion: String?
123126

124127
/// Experimental path for writing attachments (Swift Testing only.)
125128
@Option(name: .customLong("experimental-attachments-path"),

0 commit comments

Comments
 (0)