Skip to content

Commit

Permalink
chore: resolve swiftformat errors and warnings in test modules (#3854)
Browse files Browse the repository at this point in the history
* chore: resolve swiftformat errors and warnings

* updated swiftformat rules

* update rules
  • Loading branch information
phantumcode authored Oct 11, 2024
1 parent 80908f3 commit 16f41bf
Show file tree
Hide file tree
Showing 316 changed files with 3,177 additions and 2,287 deletions.
2 changes: 1 addition & 1 deletion AmplifyTestApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import UIKit

@UIApplicationMain
@main
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?
Expand Down
16 changes: 10 additions & 6 deletions AmplifyTestCommon/Helpers/AmplifyAssertions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import XCTest

@testable import CwlPreconditionTesting

public func XCTAssertThrowFatalError(_ expression: @escaping () -> Void,
file: StaticString = #file,
line: UInt = #line) throws {
public func XCTAssertThrowFatalError(
_ expression: @escaping () -> Void,
file: StaticString = #file,
line: UInt = #line
) throws {
#if (os(iOS) || os(macOS)) && (arch(arm64) || arch(x86_64))
var reached = false
let exception = catchBadInstruction {
Expand All @@ -26,9 +28,11 @@ public func XCTAssertThrowFatalError(_ expression: @escaping () -> Void,
#endif
}

public func XCTAssertNoThrowFatalError(_ expression: @escaping () -> Void,
file: StaticString = #file,
line: UInt = #line) throws {
public func XCTAssertNoThrowFatalError(
_ expression: @escaping () -> Void,
file: StaticString = #file,
line: UInt = #line
) throws {
#if (os(iOS) || os(macOS)) && (arch(arm64) || arch(x86_64))
var reached = false
let exception = catchBadInstruction {
Expand Down
2 changes: 1 addition & 1 deletion AmplifyTestCommon/Helpers/AuthSignInHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Amplify

public typealias CompletionType = (Bool, AuthError?) -> Void

public struct AuthSignInHelper {
public enum AuthSignInHelper {

public static func signUpUser(username: String, password: String, email: String) async throws -> AuthSignUpResult {
let options = AuthSignUpRequest.Options(userAttributes: [AuthUserAttribute(.email, value: email)])
Expand Down
14 changes: 8 additions & 6 deletions AmplifyTestCommon/Helpers/HubListenerTestUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Amplify
import Foundation

struct HubListenerTestUtilities {
enum HubListenerTestUtilities {

/// Blocks current thread until the listener with `token` is attached to the plugin. Returns `true` if the listener
/// becomes present before the `timeout` expires, `false` otherwise.
Expand All @@ -17,11 +17,13 @@ struct HubListenerTestUtilities {
/// - Parameter plugin: the plugin on which the listener will be checked
/// - Parameter timeout: the maximum length of time to wait for the listener to be registered
/// - Throws: if the plugin cannot be cast to `AWSHubPlugin`
static func waitForListener(with token: UnsubscribeToken,
plugin: HubCategoryPlugin? = nil,
timeout: TimeInterval,
file: StaticString = #file,
line: UInt = #line) async throws -> Bool {
static func waitForListener(
with token: UnsubscribeToken,
plugin: HubCategoryPlugin? = nil,
timeout: TimeInterval,
file: StaticString = #file,
line: UInt = #line
) async throws -> Bool {

let plugin = try plugin ?? Amplify.Hub.getPlugin(for: AWSHubPlugin.key)

Expand Down
2 changes: 1 addition & 1 deletion AmplifyTestCommon/Helpers/TypeRegistry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TypeRegistry {
hasher.combine(ObjectIdentifier(type))
}

static func ==(lhs: TypeRegistry.Key, rhs: TypeRegistry.Key) -> Bool {
static func == (lhs: TypeRegistry.Key, rhs: TypeRegistry.Key) -> Bool {
lhs.type == rhs.type
}
}
Expand Down
Loading

0 comments on commit 16f41bf

Please sign in to comment.