From 52acf5a7d058db635dc877067edc1babb3053d75 Mon Sep 17 00:00:00 2001 From: Matejkob Date: Sun, 31 Dec 2023 18:51:27 +0000 Subject: [PATCH] Run swift-format --- .../UT_ReceivedArgumentsFactory.swift | 34 +++++++------- .../UT_ReceivedInvocationsFactory.swift | 35 ++++++++------- .../Factories/UT_VariablePrefixFactory.swift | 12 ++--- .../UT_VariablesImplementationFactory.swift | 44 +++++++++---------- 4 files changed, 66 insertions(+), 59 deletions(-) diff --git a/Tests/SpyableMacroTests/Factories/UT_ReceivedArgumentsFactory.swift b/Tests/SpyableMacroTests/Factories/UT_ReceivedArgumentsFactory.swift index 5e457c6..4189d55 100644 --- a/Tests/SpyableMacroTests/Factories/UT_ReceivedArgumentsFactory.swift +++ b/Tests/SpyableMacroTests/Factories/UT_ReceivedArgumentsFactory.swift @@ -65,47 +65,48 @@ final class UT_ReceivedArgumentsFactory: XCTestCase { func testVariableDeclarationMultiArguments() throws { try assertProtocolFunction( - withFunctionDeclaration: "func foo(text: String, _ count: (x: Int, UInt?)?, final price: Decimal?)", + withFunctionDeclaration: + "func foo(text: String, _ count: (x: Int, UInt?)?, final price: Decimal?)", prefixForVariable: "_prefix_", expectingVariableDeclaration: """ - var _prefix_ReceivedArguments: (text: String, count: (x: Int, UInt?)?, price: Decimal?)? - """ + var _prefix_ReceivedArguments: (text: String, count: (x: Int, UInt?)?, price: Decimal?)? + """ ) } func testVariableDeclarationMultiArgumentsWithEscapingAttribute() throws { try assertProtocolFunction( withFunctionDeclaration: """ - func foo(completion: @escaping () -> Void, _ count: (x: Int, UInt?)?, final price: Decimal?) - """, + func foo(completion: @escaping () -> Void, _ count: (x: Int, UInt?)?, final price: Decimal?) + """, prefixForVariable: "_prefix_", expectingVariableDeclaration: """ - var _prefix_ReceivedArguments: (completion: () -> Void, count: (x: Int, UInt?)?, price: Decimal?)? - """ + var _prefix_ReceivedArguments: (completion: () -> Void, count: (x: Int, UInt?)?, price: Decimal?)? + """ ) } func testVariableDeclarationMultiArgumentsWithSomeClosureArgument() throws { try assertProtocolFunction( withFunctionDeclaration: """ - func foo(completion: () -> Void, _ count: (x: Int, UInt?)?, final price: Decimal?) - """, + func foo(completion: () -> Void, _ count: (x: Int, UInt?)?, final price: Decimal?) + """, prefixForVariable: "_prefix_", expectingVariableDeclaration: """ - var _prefix_ReceivedArguments: (completion: () -> Void, count: (x: Int, UInt?)?, price: Decimal?)? - """ + var _prefix_ReceivedArguments: (completion: () -> Void, count: (x: Int, UInt?)?, price: Decimal?)? + """ ) } func testVariableDeclarationMultiArgumentsWithSomeOptionalClosureArgument() throws { try assertProtocolFunction( withFunctionDeclaration: """ - func foo(completion: (() -> Void)?, _ count: (x: Int, UInt?)?, final price: Decimal?) - """, + func foo(completion: (() -> Void)?, _ count: (x: Int, UInt?)?, final price: Decimal?) + """, prefixForVariable: "_prefix_", expectingVariableDeclaration: """ - var _prefix_ReceivedArguments: (completion: (() -> Void)?, count: (x: Int, UInt?)?, price: Decimal?)? - """ + var _prefix_ReceivedArguments: (completion: (() -> Void)?, count: (x: Int, UInt?)?, price: Decimal?)? + """ ) } @@ -137,7 +138,8 @@ final class UT_ReceivedArgumentsFactory: XCTestCase { func testAssignValueToVariableExpressionMultiArguments() throws { try assertProtocolFunction( - withFunctionDeclaration: "func foo(text: String, _ count: (x: Int, UInt?)?, final price: Decimal?)", + withFunctionDeclaration: + "func foo(text: String, _ count: (x: Int, UInt?)?, final price: Decimal?)", prefixForVariable: "_prefix_", expectingExpression: "_prefix_ReceivedArguments = (text, count, price)" ) diff --git a/Tests/SpyableMacroTests/Factories/UT_ReceivedInvocationsFactory.swift b/Tests/SpyableMacroTests/Factories/UT_ReceivedInvocationsFactory.swift index 2fb031d..a4bcb71 100644 --- a/Tests/SpyableMacroTests/Factories/UT_ReceivedInvocationsFactory.swift +++ b/Tests/SpyableMacroTests/Factories/UT_ReceivedInvocationsFactory.swift @@ -20,8 +20,8 @@ final class UT_ReceivedInvocationsFactory: XCTestCase { withFunctionDeclaration: "func foo(_ tuple: (text: String, (Decimal?, date: Date))?)", prefixForVariable: "_prefix_", expectingVariableDeclaration: """ - var _prefix_ReceivedInvocations: [(text: String, (Decimal?, date: Date))?] = [] - """ + var _prefix_ReceivedInvocations: [(text: String, (Decimal?, date: Date))?] = [] + """ ) } @@ -51,41 +51,45 @@ final class UT_ReceivedInvocationsFactory: XCTestCase { func testVariableDeclarationMultiArguments() throws { try assertProtocolFunction( - withFunctionDeclaration: "func foo(text: String, _ count: (x: Int, UInt?)?, final price: Decimal?)", + withFunctionDeclaration: + "func foo(text: String, _ count: (x: Int, UInt?)?, final price: Decimal?)", prefixForVariable: "_prefix_", expectingVariableDeclaration: """ - var _prefix_ReceivedInvocations: [(text: String, count: (x: Int, UInt?)?, price: Decimal?)] = [] - """ + var _prefix_ReceivedInvocations: [(text: String, count: (x: Int, UInt?)?, price: Decimal?)] = [] + """ ) } func testVariableDeclarationMultiArgumentsWithEscapingAttribute() throws { try assertProtocolFunction( - withFunctionDeclaration: "func foo(completion: @escaping () -> Void, count: UInt, final price: Decimal?)", + withFunctionDeclaration: + "func foo(completion: @escaping () -> Void, count: UInt, final price: Decimal?)", prefixForVariable: "_prefix_", expectingVariableDeclaration: """ - var _prefix_ReceivedInvocations: [(completion: () -> Void, count: UInt, price: Decimal?)] = [] - """ + var _prefix_ReceivedInvocations: [(completion: () -> Void, count: UInt, price: Decimal?)] = [] + """ ) } func testVariableDeclarationMultiArgumentsWithSomeClosureArgument() throws { try assertProtocolFunction( - withFunctionDeclaration: "func bar(completion: () -> Void, _ count: (x: Int, UInt?)?, final price: Decimal?)", + withFunctionDeclaration: + "func bar(completion: () -> Void, _ count: (x: Int, UInt?)?, final price: Decimal?)", prefixForVariable: "_prefix_", expectingVariableDeclaration: """ - var _prefix_ReceivedInvocations: [(completion: () -> Void, count: (x: Int, UInt?)?, price: Decimal?)] = [] - """ + var _prefix_ReceivedInvocations: [(completion: () -> Void, count: (x: Int, UInt?)?, price: Decimal?)] = [] + """ ) } func testVariableDeclarationMultiArgumentsWithSomeOptionalClosureArgument() throws { try assertProtocolFunction( - withFunctionDeclaration: "func func_name(completion: (() -> Void)?, _ count: (x: Int, UInt?)?, final price: Decimal?)", + withFunctionDeclaration: + "func func_name(completion: (() -> Void)?, _ count: (x: Int, UInt?)?, final price: Decimal?)", prefixForVariable: "_prefix_", expectingVariableDeclaration: """ - var _prefix_ReceivedInvocations: [(completion: (() -> Void)?, count: (x: Int, UInt?)?, price: Decimal?)] = [] - """ + var _prefix_ReceivedInvocations: [(completion: (() -> Void)?, count: (x: Int, UInt?)?, price: Decimal?)] = [] + """ ) } @@ -109,7 +113,8 @@ final class UT_ReceivedInvocationsFactory: XCTestCase { func testAppendValueToVariableExpressionMultiArguments() throws { try assertProtocolFunction( - withFunctionDeclaration: "func foo(text: String, _ count: (x: Int, UInt?)?, final price: Decimal?)", + withFunctionDeclaration: + "func foo(text: String, _ count: (x: Int, UInt?)?, final price: Decimal?)", prefixForVariable: "_prefix_", expectingExpression: "_prefix_ReceivedInvocations.append((text, count, price))" ) diff --git a/Tests/SpyableMacroTests/Factories/UT_VariablePrefixFactory.swift b/Tests/SpyableMacroTests/Factories/UT_VariablePrefixFactory.swift index 5a69c32..41e3f77 100644 --- a/Tests/SpyableMacroTests/Factories/UT_VariablePrefixFactory.swift +++ b/Tests/SpyableMacroTests/Factories/UT_VariablePrefixFactory.swift @@ -35,12 +35,12 @@ final class UT_VariablePrefixFactory: XCTestCase { func testTextFunctionWithMultiArguments() throws { try assertProtocolFunction( withFunctionDeclaration: """ - func foo( - text1 text2: String, - _ count2: Int, - product1 product2: (name: String, price: Decimal) - ) -> String - """, + func foo( + text1 text2: String, + _ count2: Int, + product1 product2: (name: String, price: Decimal) + ) -> String + """, expectingVariableName: "fooText1Product1" ) } diff --git a/Tests/SpyableMacroTests/Factories/UT_VariablesImplementationFactory.swift b/Tests/SpyableMacroTests/Factories/UT_VariablesImplementationFactory.swift index 706b9dc..ee49aa6 100644 --- a/Tests/SpyableMacroTests/Factories/UT_VariablesImplementationFactory.swift +++ b/Tests/SpyableMacroTests/Factories/UT_VariablesImplementationFactory.swift @@ -4,23 +4,23 @@ import XCTest @testable import SpyableMacro final class UT_VariablesImplementationFactory: XCTestCase { - + // MARK: - Variables Declarations func testVariablesDeclarations() throws { try assertProtocolVariable( withVariableDeclaration: "var point: (x: Int, y: Int?, (Int, Int)) { get }", expectingVariableDeclaration: """ - var point: (x: Int, y: Int?, (Int, Int)) { - get { - underlyingPoint - } - set { - underlyingPoint = newValue - } - } - var underlyingPoint: ((x: Int, y: Int?, (Int, Int)))! - """ + var point: (x: Int, y: Int?, (Int, Int)) { + get { + underlyingPoint + } + set { + underlyingPoint = newValue + } + } + var underlyingPoint: ((x: Int, y: Int?, (Int, Int)))! + """ ) } @@ -35,16 +35,16 @@ final class UT_VariablesImplementationFactory: XCTestCase { try assertProtocolVariable( withVariableDeclaration: "var completion: () -> Void { get }", expectingVariableDeclaration: """ - var completion: () -> Void { - get { - underlyingCompletion - } - set { - underlyingCompletion = newValue - } - } - var underlyingCompletion: (() -> Void)! - """ + var completion: () -> Void { + get { + underlyingCompletion + } + set { + underlyingCompletion = newValue + } + } + var underlyingCompletion: (() -> Void)! + """ ) } @@ -57,7 +57,7 @@ final class UT_VariablesImplementationFactory: XCTestCase { ) ) { error in XCTAssertEqual( - error as! SpyableDiagnostic, + error as! SpyableDiagnostic, SpyableDiagnostic.variableDeclInProtocolWithNotSingleBinding ) }