Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 6 prep - Part 1 #106

Merged
merged 2 commits into from
Jun 11, 2024
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
4 changes: 2 additions & 2 deletions Sources/OpenAPIRuntime/Base/OpenAPIMIMEType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
import Foundation

/// A container for a parsed, valid MIME type.
@_spi(Generated) public struct OpenAPIMIMEType: Equatable {
@_spi(Generated) public struct OpenAPIMIMEType: Equatable, Sendable {

/// XML MIME type
public static let xml: OpenAPIMIMEType = .init(kind: .concrete(type: "application", subtype: "xml"))

/// The kind of the MIME type.
public enum Kind: Equatable {
public enum Kind: Equatable, Sendable {

/// Any, spelled as `*/*`.
case any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class Test_ContentDisposition: Test_Runtime {
input: String,
parsed: ContentDisposition?,
output: String?,
file: StaticString = #file,
file: StaticString = #filePath,
line: UInt = #line
) {
let value = ContentDisposition(rawValue: input)
Expand Down
4 changes: 2 additions & 2 deletions Tests/OpenAPIRuntimeTests/Base/Test_OpenAPIMIMEType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ final class Test_OpenAPIMIMEType: Test_Runtime {
receivedParameters: [String: String],
against option: OpenAPIMIMEType,
expected expectedMatch: OpenAPIMIMEType.Match,
file: StaticString = #file,
file: StaticString = #filePath,
line: UInt = #line
) {
let result = OpenAPIMIMEType.evaluate(
Expand All @@ -109,7 +109,7 @@ final class Test_OpenAPIMIMEType: Test_Runtime {
func testJSONWith2Params(
against option: OpenAPIMIMEType,
expected expectedMatch: OpenAPIMIMEType.Match,
file: StaticString = #file,
file: StaticString = #filePath,
line: UInt = #line
) {
testCase(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class Test_CommonConverterExtensions: Test_Runtime {
received: String?,
options: [String],
expected expectedChoice: String,
file: StaticString = #file,
file: StaticString = #filePath,
line: UInt = #line
) throws {
let choice = try converter.bestContentType(received: received.map { .init($0)! }, options: options)
Expand Down Expand Up @@ -109,7 +109,7 @@ final class Test_CommonConverterExtensions: Test_Runtime {
}

func testExtractContentDispositionNameAndFilename() throws {
func testCase(value: String?, name: String?, filename: String?, file: StaticString = #file, line: UInt = #line)
func testCase(value: String?, name: String?, filename: String?, file: StaticString = #filePath, line: UInt = #line)
throws
{
let headerFields: HTTPFields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import XCTest
import Foundation

final class Test_ServerSentEventsDecoding: Test_Runtime {
func _test(input: String, output: [ServerSentEvent], file: StaticString = #file, line: UInt = #line) async throws {
func _test(input: String, output: [ServerSentEvent], file: StaticString = #filePath, line: UInt = #line) async throws {
let sequence = asOneBytePerElementSequence(ArraySlice(input.utf8)).asDecodedServerSentEvents()
let events = try await [ServerSentEvent](collecting: sequence)
XCTAssertEqual(events.count, output.count, file: file, line: line)
Expand Down Expand Up @@ -85,7 +85,7 @@ final class Test_ServerSentEventsDecoding: Test_Runtime {
func _testJSONData<JSONType: Decodable & Hashable & Sendable>(
input: String,
output: [ServerSentEventWithJSONData<JSONType>],
file: StaticString = #file,
file: StaticString = #filePath,
line: UInt = #line
) async throws {
let sequence = asOneBytePerElementSequence(ArraySlice(input.utf8))
Expand Down Expand Up @@ -123,7 +123,7 @@ final class Test_ServerSentEventsDecoding: Test_Runtime {
}

final class Test_ServerSentEventsDecoding_Lines: Test_Runtime {
func _test(input: String, output: [String], file: StaticString = #file, line: UInt = #line) async throws {
func _test(input: String, output: [String], file: StaticString = #filePath, line: UInt = #line) async throws {
let upstream = asOneBytePerElementSequence(ArraySlice(input.utf8))
let sequence = ServerSentEventsLineDeserializationSequence(upstream: upstream)
let lines = try await [ArraySlice<UInt8>](collecting: sequence)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import XCTest
import Foundation

final class Test_ServerSentEventsEncoding: Test_Runtime {
func _test(input: [ServerSentEvent], output: String, file: StaticString = #file, line: UInt = #line) async throws {
func _test(input: [ServerSentEvent], output: String, file: StaticString = #filePath, line: UInt = #line) async throws {
let sequence = WrappedSyncSequence(sequence: input).asEncodedServerSentEvents()
try await XCTAssertEqualAsyncData(sequence, output.utf8, file: file, line: line)
}
Expand Down Expand Up @@ -73,7 +73,7 @@ final class Test_ServerSentEventsEncoding: Test_Runtime {
func _testJSONData<JSONType: Encodable & Hashable & Sendable>(
input: [ServerSentEventWithJSONData<JSONType>],
output: String,
file: StaticString = #file,
file: StaticString = #filePath,
line: UInt = #line
) async throws {
let sequence = WrappedSyncSequence(sequence: input).asEncodedServerSentEventsWithJSONData()
Expand Down
4 changes: 2 additions & 2 deletions Tests/OpenAPIRuntimeTests/Interface/Test_HTTPBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ final class Test_Body: Test_Runtime {
}

extension Test_Body {
func _testConsume(_ body: HTTPBody, expected: HTTPBody.ByteChunk, file: StaticString = #file, line: UInt = #line)
func _testConsume(_ body: HTTPBody, expected: HTTPBody.ByteChunk, file: StaticString = #filePath, line: UInt = #line)
async throws
{
let output = try await ArraySlice(collecting: body, upTo: .max)
XCTAssertEqual(output, expected, file: file, line: line)
}

func _testConsume(_ body: HTTPBody, expected: some StringProtocol, file: StaticString = #file, line: UInt = #line)
func _testConsume(_ body: HTTPBody, expected: some StringProtocol, file: StaticString = #filePath, line: UInt = #line)
async throws
{
let output = try await String(collecting: body, upTo: .max)
Expand Down
2 changes: 1 addition & 1 deletion Tests/OpenAPIRuntimeTests/Test_Runtime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ struct MockCustomCoder: CustomCoder {
/// - rhs: The expected absolute string representation.
/// - file: The file name to include in the failure message (default is the source file where this function is called).
/// - line: The line number to include in the failure message (default is the line where this function is called).
public func XCTAssertEqualURLString(_ lhs: URL?, _ rhs: String, file: StaticString = #file, line: UInt = #line) {
public func XCTAssertEqualURLString(_ lhs: URL?, _ rhs: String, file: StaticString = #filePath, line: UInt = #line) {
guard let lhs else {
XCTFail("URL is nil")
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ final class Test_URIValueFromNodeDecoder: Test_Runtime {
key: String,
style: URICoderConfiguration.Style = .form,
explode: Bool = true,
file: StaticString = #file,
file: StaticString = #filePath,
line: UInt = #line
) throws {
let decoder = URIValueFromNodeDecoder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ final class Test_URICodingRoundtrip: Test_Runtime {
_ value: T,
key: String,
_ variants: Variants<T>,
file: StaticString = #file,
file: StaticString = #filePath,
line: UInt = #line
) throws {
func testVariant(name: String, configuration: URICoderConfiguration, variant: Variants<T>.Input) throws {
Expand Down