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 Strict Concurrency #23

Merged
merged 2 commits into from
Jul 2, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import PackageDescription


#if swift(<6)
let swiftConcurrency: SwiftSetting = .enableExperimentalFeature("SwiftConcurrency")
let swiftConcurrency: SwiftSetting = .enableExperimentalFeature("StrictConcurrency")
#else
let swiftConcurrency: SwiftSetting = .enableUpcomingFeature("SwiftConcurrency")
let swiftConcurrency: SwiftSetting = .enableUpcomingFeature("StrictConcurrency")
#endif


Expand Down
1 change: 1 addition & 0 deletions Sources/XCTestApp/TestAppTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/// A collection of test cases that can be executed in an ``TestAppView``.
public protocol TestAppTestCase: Identifiable {
/// Implement this method to run all the tests that should be executed.
@MainActor
func runTests() async throws
}

Expand Down
6 changes: 3 additions & 3 deletions Sources/XCTestExtensions/XCTAssertThrowsErrorAsync.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
/// - line: The line number where the failure occurs. The default is the line number where you call this function.
/// - errorHandler: An optional handler for errors that expression throws.
public func XCTAssertThrowsErrorAsync<T>(
_ expression: @autoclosure () async throws -> T,
_ message: @autoclosure () -> String = "",
_ expression: @autoclosure @Sendable () async throws -> T,
_ message: @autoclosure @Sendable () -> String = "",

Check warning on line 24 in Sources/XCTestExtensions/XCTAssertThrowsErrorAsync.swift

View check run for this annotation

Codecov / codecov/patch

Sources/XCTestExtensions/XCTAssertThrowsErrorAsync.swift#L24

Added line #L24 was not covered by tests
file: StaticString = #filePath,
line: UInt = #line,
_ errorHandler: (Error) throws -> Void = { _ in }
_ errorHandler: @Sendable (Error) throws -> Void = { _ in }

Check warning on line 27 in Sources/XCTestExtensions/XCTAssertThrowsErrorAsync.swift

View check run for this annotation

Codecov / codecov/patch

Sources/XCTestExtensions/XCTAssertThrowsErrorAsync.swift#L27

Added line #L27 was not covered by tests
) async rethrows {
do {
_ = try await expression()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extension XCTestCase {
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(visionOS, unavailable)
@MainActor
public func disablePasswordAutofill() throws {
let settingsApp = XCUIApplication(bundleIdentifier: "com.apple.Preferences")
settingsApp.terminate()
Expand Down
2 changes: 1 addition & 1 deletion Sources/XCTestExtensions/XCUIElement+TextEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import XCTest
/// An internal flag that is used to test the flaky simulator text entry behavior in the iOS simulator.
///
/// Do not use this flag outside of the UI tests in the ``XCTestExtensions`` target!
var simulateFlakySimulatorTextEntry = false
@MainActor var simulateFlakySimulatorTextEntry = false


extension XCUIElement {
Expand Down
2 changes: 2 additions & 0 deletions Tests/UITests/TestAppUITests/XCTestExtensionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
// currently don't know how to swipe on the Reality Launcher. So not a super big use case for us now.
throw XCTSkip("VisionOS will typically have apps installed on the first screen anyways.")
#endif
let springboard = XCUIApplication(bundleIdentifier: XCUIApplication.homeScreenBundle)

Check warning on line 48 in Tests/UITests/TestAppUITests/XCTestExtensionsTests.swift

View workflow job for this annotation

GitHub Actions / Build and Test UI Tests visionOS / Test using xcodebuild or run fastlane

code after 'throw' will never be executed
springboard.activate()
springboard.swipeRight()

Expand All @@ -59,6 +59,7 @@
XCTAssert(app.staticTexts["No secure text set ..."].waitForExistence(timeout: 5))
}

@MainActor
func testDisablePasswordAutofill() throws {
#if os(iOS)
try disablePasswordAutofill()
Expand All @@ -75,6 +76,7 @@
try app.callTextEntryExtensions()
}

@MainActor
func testFlakyTextEntry() throws {
let app = XCUIApplication()
app.launch()
Expand Down
Loading