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

Test with Xcode 14.0 and Swift 5.7 #245

Merged
merged 7 commits into from Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -40,6 +40,11 @@ jobs:
macOS: "12"
iOS: "15.5"
tvOS: "15.4"
useCodecov: "false"
- xcode: "14.0" # Swift 5.7
macOS: "12"
iOS: "16.0"
tvOS: "16.0"
useCodecov: "true"

runs-on: macos-${{ matrix.macOS }}
Expand Down
58 changes: 37 additions & 21 deletions Tests/XMLCoderTests/AdvancedFeatures/ErrorContextTest.swift
Expand Up @@ -31,26 +31,34 @@ final class ErrorContextTest: XCTestCase {
return
}

#if os(Linux) && swift(<5.4)
// XML Parser returns a different column on Linux
// https://bugs.swift.org/browse/SR-11192
XCTAssertEqual(ctx.debugDescription, """
let column2 = """
\(underlying.localizedDescription) \
at line 1, column 2:
`<blah `
"""
let column7 = """
\(underlying.localizedDescription) \
at line 1, column 7:
`ah //>`
""")
#elseif os(Windows) || os(Linux)
XCTAssertEqual(ctx.debugDescription, """
"""
let column10 = """
\(underlying.localizedDescription) \
at line 1, column 10:
`//>`
""")
"""

#if os(Linux) && swift(<5.4)
// XML Parser returns a different column on Linux and iOS 16+
// https://bugs.swift.org/browse/SR-11192
XCTAssertEqual(ctx.debugDescription, column7)
#elseif os(Windows) || os(Linux)
XCTAssertEqual(ctx.debugDescription, column10)
#else
XCTAssertEqual(ctx.debugDescription, """
\(underlying.localizedDescription) \
at line 1, column 2:
`<blah `
""")
if #available(iOS 16.0, tvOS 16.0, macOS 13.0, *) {
XCTAssertEqual(ctx.debugDescription, column7)
Copy link
Member

Choose a reason for hiding this comment

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

Do we (want to) guarantee error output from Foundation? If so, this PR alone seems to indicate we cannot.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This output seemed to be pretty stable up to this point, and I haven't found a different way to test the error context functionality end-to-end without being exposed to these caveats with how Foundation handle this.

} else {
XCTAssertEqual(ctx.debugDescription, column2)
}
#endif
}
}
Expand Down Expand Up @@ -81,22 +89,30 @@ final class ErrorContextTest: XCTestCase {
return
}

#if os(Linux)
// XML Parser returns a different column on Linux
// https://bugs.swift.org/browse/SR-11192
XCTAssertEqual(ctx.debugDescription, """
let line4column1 = """
\(underlying.localizedDescription) \
at line 4, column 1:
`blah>
<c`
""")
#else
XCTAssertEqual(ctx.debugDescription, """
"""

let line3column8 = """
\(underlying.localizedDescription) \
at line 3, column 8:
`blah>
<c`
""")
"""

#if os(Linux)
// XML Parser returns a different column on Linux
// https://bugs.swift.org/browse/SR-11192
XCTAssertEqual(ctx.debugDescription, line4column1)
#else
if #available(iOS 16.0, tvOS 16.0, macOS 13.0, *) {
XCTAssertEqual(ctx.debugDescription, line4column1)
} else {
XCTAssertEqual(ctx.debugDescription, line3column8)
}
#endif
}
}
Expand Down
9 changes: 6 additions & 3 deletions test_xcodebuild.sh
Expand Up @@ -8,10 +8,13 @@ sudo xcode-select --switch /Applications/$1.app/Contents/Developer
xcodebuild -version
xcodebuild test -scheme XMLCoder \
-sdk iphonesimulator -destination "$IOS_DEVICE" | xcpretty
xcodebuild test -scheme XMLCoder \
-sdk appletvsimulator -destination "$TVOS_DEVICE" | xcpretty

if [ "$CODECOV_JOB" = "true"] ; then
if $(xcodebuild -showdestinations -scheme XMLCoder | grep 'platform:tvOS.* OS:'); then
xcodebuild test -scheme XMLCoder \
-sdk appletvsimulator -destination "$TVOS_DEVICE" | xcpretty
fi

if [ "$CODECOV_JOB" = "true" ] ; then
xcodebuild test -enableCodeCoverage YES -scheme XMLCoder \
-sdk macosx | xcpretty
bash <(curl -s https://codecov.io/bash)
Expand Down