diff --git a/Sources/MockoloFramework/Templates/NominalTemplate.swift b/Sources/MockoloFramework/Templates/NominalTemplate.swift index 2f7fff5c..50b35889 100644 --- a/Sources/MockoloFramework/Templates/NominalTemplate.swift +++ b/Sources/MockoloFramework/Templates/NominalTemplate.swift @@ -253,7 +253,7 @@ extension NominalModel { var template = "" if !extraVarsToDecl.isEmpty { - template += "\(1.tab)\(extraVarsToDecl)\n" + template += "\(extraVarsToDecl)\n" } if needBlankInit { diff --git a/Sources/MockoloFramework/Templates/VariableTemplate.swift b/Sources/MockoloFramework/Templates/VariableTemplate.swift index e02a463a..f03c92ac 100644 --- a/Sources/MockoloFramework/Templates/VariableTemplate.swift +++ b/Sources/MockoloFramework/Templates/VariableTemplate.swift @@ -44,7 +44,7 @@ extension VariableModel { var assignVal = "" if !shouldOverride, let val = underlyingVarDefaultVal { - assignVal = "= \(val)" + assignVal = " = \(val)" } let privateSetSpace = allowSetCallCount ? "" : "\(String.privateSet) " @@ -89,7 +89,7 @@ extension VariableModel { template = """ \(setCallCountVarDecl) - \(1.tab)\(propertyWrapper)\(staticSpace)private var \(underlyingName): \(underlyingType) \(assignVal)\(accessorBlock) + \(1.tab)\(propertyWrapper)\(staticSpace)private var \(underlyingName): \(underlyingType)\(assignVal)\(accessorBlock) \(1.tab)\(acl)\(staticSpace)\(overrideStr)\(modifierTypeStr)var \(name): \(type.typeName) { \(2.tab)get { return \(underlyingName) } \(2.tab)set { \(underlyingName) = newValue } @@ -99,7 +99,7 @@ extension VariableModel { template = """ \(setCallCountVarDecl) - \(1.tab)\(propertyWrapper)\(acl)\(staticSpace)\(overrideStr)\(modifierTypeStr)var \(name): \(type.typeName) \(assignVal)\(accessorBlock) + \(1.tab)\(propertyWrapper)\(acl)\(staticSpace)\(overrideStr)\(modifierTypeStr)var \(name): \(type.typeName)\(assignVal)\(accessorBlock) """ } diff --git a/Tests/MockoloTestCase.swift b/Tests/MockoloTestCase.swift index 85842ba8..2edc9676 100644 --- a/Tests/MockoloTestCase.swift +++ b/Tests/MockoloTestCase.swift @@ -113,31 +113,31 @@ class MockoloTestCase: XCTestCase { } try generate(sourceDirs: [], - sourceFiles: srcFilePaths, - parser: SourceParser(), - exclusionSuffixes: ["Mocks", "Tests"], - mockFilePaths: mockFilePaths, - annotation: String.mockAnnotation, - header: header, - macro: "MOCK", - declType: declType, - useTemplateFunc: useTemplateFunc, - useMockObservable: useMockObservable, - allowSetCallCount: allowSetCallCount, - enableFuncArgsHistory: enableFuncArgsHistory, - disableCombineDefaultValues: disableCombineDefaultValues, - mockFinal: mockFinal, - testableImports: testableImports, - customImports: [], - excludeImports: [], - to: dstFilePath, - loggingLevel: 3, - concurrencyLimit: concurrencyLimit, - onCompletion: { ret in - let output = (try? String(contentsOf: URL(fileURLWithPath: self.defaultDstFilePath), encoding: .utf8)) ?? "" - let outputContents = output.components(separatedBy: .whitespacesAndNewlines).filter{!$0.isEmpty} - let fixtureContents = dstContent.components(separatedBy: .whitespacesAndNewlines).filter{!$0.isEmpty} - XCTAssert(outputContents.contains(subArray: fixtureContents), "output:\n" + output) + sourceFiles: srcFilePaths, + parser: SourceParser(), + exclusionSuffixes: ["Mocks", "Tests"], + mockFilePaths: mockFilePaths, + annotation: String.mockAnnotation, + header: header, + macro: "MOCK", + declType: declType, + useTemplateFunc: useTemplateFunc, + useMockObservable: useMockObservable, + allowSetCallCount: allowSetCallCount, + enableFuncArgsHistory: enableFuncArgsHistory, + disableCombineDefaultValues: disableCombineDefaultValues, + mockFinal: mockFinal, + testableImports: testableImports, + customImports: [], + excludeImports: [], + to: dstFilePath, + loggingLevel: 3, + concurrencyLimit: concurrencyLimit, + onCompletion: { ret in + let output = (try? String(contentsOf: URL(fileURLWithPath: self.defaultDstFilePath), encoding: .utf8)) ?? "" + let outputContents = output.components(separatedBy: .newlines).filter { !$0.isEmpty && !$0.allSatisfy(\.isWhitespace) } + let fixtureContents = dstContent.components(separatedBy: .newlines).filter { !$0.isEmpty && !$0.allSatisfy(\.isWhitespace) } + XCTAssert(outputContents.contains(subArray: fixtureContents), "output:\n" + output) }) } } diff --git a/Tests/TestActor/FixtureGlobalActor.swift b/Tests/TestActor/FixtureGlobalActor.swift index 9201ac33..001882e2 100644 --- a/Tests/TestActor/FixtureGlobalActor.swift +++ b/Tests/TestActor/FixtureGlobalActor.swift @@ -19,9 +19,7 @@ class RootControllerMock: RootController { self._viewController = viewController } - - - private var _viewController: UIViewController! + private var _viewController: UIViewController! var viewController: UIViewController { get { return _viewController } set { _viewController = newValue } @@ -34,7 +32,7 @@ class RootBuildableMock: RootBuildable { private(set) var buildCallCount = 0 var buildHandler: (() -> RootController)? - func build() -> RootController { + func build() -> RootController { buildCallCount += 1 if let buildHandler = buildHandler { return buildHandler() diff --git a/Tests/TestArgumentsHistory/FixtureArgumentsHistory.swift b/Tests/TestArgumentsHistory/FixtureArgumentsHistory.swift index 7feb1f0e..0a32db58 100644 --- a/Tests/TestArgumentsHistory/FixtureArgumentsHistory.swift +++ b/Tests/TestArgumentsHistory/FixtureArgumentsHistory.swift @@ -17,7 +17,7 @@ class FooMock: Foo { private(set) var fooFuncCallCount = 0 var fooFuncArgValues = [Int]() var fooFuncHandler: ((Int) -> ())? - func fooFunc(val: Int) { + func fooFunc(val: Int) { fooFuncCallCount += 1 fooFuncArgValues.append(val) if let fooFuncHandler = fooFuncHandler { @@ -29,7 +29,7 @@ class FooMock: Foo { private(set) var barFuncCallCount = 0 var barFuncArgValues = [[Int]]() var barFuncHandler: (([Int]) -> ())? - func barFunc(for: [Int]) { + func barFunc(for: [Int]) { barFuncCallCount += 1 barFuncArgValues.append(`for`) if let barFuncHandler = barFuncHandler { @@ -41,7 +41,7 @@ class FooMock: Foo { private(set) var bazFuncCallCount = 0 var bazFuncArgValues = [(String, Float)]() var bazFuncHandler: ((String, Float) -> ())? - func bazFunc(arg: String, default: Float) { + func bazFunc(arg: String, default: Float) { bazFuncCallCount += 1 bazFuncArgValues.append((arg, `default`)) if let bazFuncHandler = bazFuncHandler { @@ -61,7 +61,7 @@ class FooMock: Foo { private(set) var fooFuncCallCount = 0 var fooFuncArgValues = [Int]() var fooFuncHandler: ((Int) -> ())? - func fooFunc(val: Int) { + func fooFunc(val: Int) { fooFuncCallCount += 1 fooFuncArgValues.append(val) if let fooFuncHandler = fooFuncHandler { @@ -72,7 +72,7 @@ class FooMock: Foo { private(set) var barFuncCallCount = 0 var barFuncHandler: (([Int]) -> ())? - func barFunc(for: [Int]) { + func barFunc(for: [Int]) { barFuncCallCount += 1 if let barFuncHandler = barFuncHandler { barFuncHandler(`for`) @@ -83,7 +83,7 @@ class FooMock: Foo { private(set) var bazFuncCallCount = 0 var bazFuncArgValues = [(String, Float)]() var bazFuncHandler: ((String, Float) -> ())? - func bazFunc(arg: String, default: Float) { + func bazFunc(arg: String, default: Float) { bazFuncCallCount += 1 bazFuncArgValues.append((arg, `default`)) if let bazFuncHandler = bazFuncHandler { @@ -236,7 +236,7 @@ class FooMock: Foo { private(set) var fooFuncVal1CallCount = 0 var fooFuncVal1ArgValues = [Int]() var fooFuncVal1Handler: ((Int) -> ())? - func fooFunc(val1: Int) { + func fooFunc(val1: Int) { fooFuncVal1CallCount += 1 fooFuncVal1ArgValues.append(val1) @@ -249,7 +249,7 @@ class FooMock: Foo { private(set) var fooFuncVal1StringCallCount = 0 var fooFuncVal1StringArgValues = [String]() var fooFuncVal1StringHandler: ((String) -> ())? - func fooFunc(val1: String) { + func fooFunc(val1: String) { fooFuncVal1StringCallCount += 1 fooFuncVal1StringArgValues.append(val1) @@ -261,7 +261,7 @@ class FooMock: Foo { private(set) var fooFuncVal2CallCount = 0 var fooFuncVal2ArgValues = [Int]() var fooFuncVal2Handler: ((Int) -> ())? - func fooFunc(val2: Int) { + func fooFunc(val2: Int) { fooFuncVal2CallCount += 1 fooFuncVal2ArgValues.append(val2) @@ -323,16 +323,17 @@ let argumentsHistoryInoutCaseMock = """ class FooMock: Foo { init() { } - private(set) var fooFuncCallCount = 0 + + private(set) var fooFuncCallCount = 0 var fooFuncArgValues = [Int]() var fooFuncHandler: ((inout Int) -> ())? func fooFunc(val: inout Int) { fooFuncCallCount += 1 fooFuncArgValues.append(val) - if let fooFuncHandler = fooFuncHandler { fooFuncHandler(&val) } + } private(set) var barFuncCallCount = 0 @@ -341,10 +342,10 @@ class FooMock: Foo { func barFunc(into val: inout Int) { barFuncCallCount += 1 barFuncArgValues.append(val) - if let barFuncHandler = barFuncHandler { - barFuncHandler(&val) + barFuncHandler(&val) } + } } """ @@ -433,8 +434,7 @@ protocol Foo { let argumentsHistoryAutoclosureCaseMock = """ class FooMock: Foo { - init() { - } + init() { } private(set) var fooFuncCallCount = 0 var fooFuncHandler: ((@autoclosure () -> Int) -> ())? diff --git a/Tests/TestClassMocking/FixtureMockableClass.swift b/Tests/TestClassMocking/FixtureMockableClass.swift index a8f78029..a146c71a 100644 --- a/Tests/TestClassMocking/FixtureMockableClass.swift +++ b/Tests/TestClassMocking/FixtureMockableClass.swift @@ -126,7 +126,7 @@ public class LowMock: Low { private(set) var barCallCount = 0 var barHandler: (() -> ())? - override func bar() { + override func bar() { barCallCount += 1 if let barHandler = barHandler { barHandler() @@ -176,14 +176,13 @@ public class LowMock: Low { private(set) var whatSetCallCount = 0 override var what: Float { didSet { whatSetCallCount += 1 } } - private(set) var barCallCount = 0 + private(set) var barCallCount = 0 var barHandler: (() -> ())? - override func bar() { + override func bar() { barCallCount += 1 if let barHandler = barHandler { barHandler() } - } private(set) var fooCallCount = 0 @@ -206,5 +205,4 @@ public class LowMock: Low { } } } - """ diff --git a/Tests/TestCombine/FixtureCombine.swift b/Tests/TestCombine/FixtureCombine.swift index 10ecf7f8..d0368a4c 100644 --- a/Tests/TestCombine/FixtureCombine.swift +++ b/Tests/TestCombine/FixtureCombine.swift @@ -56,7 +56,7 @@ public class FooPublishedMock: FooPublished { public private(set) var myCustomTypePublisherSubject = PassthroughSubject() public private(set) var myNonOptionalSetCallCount = 0 - @CustomPropertyWrapper private var _myNonOptional: NonOptional! { didSet { myNonOptionalSetCallCount += 1 } } + @CustomPropertyWrapper private var _myNonOptional: NonOptional! { didSet { myNonOptionalSetCallCount += 1 } } public var myNonOptional: NonOptional { get { return _myNonOptional } set { _myNonOptional = newValue } @@ -210,13 +210,12 @@ public class ChildMock: Child { self.myStringInBase = myStringInBase } - public var myStringPublisher: AnyPublisher { return self.$myStringInBase.map { $0 }.setFailureType(to: Never.self).eraseToAnyPublisher() } + public var myStringPublisher: AnyPublisher { return self.$myStringInBase.map { $0 }.setFailureType(to: Never.self).eraseToAnyPublisher() } public var dictionaryPublisher: AnyPublisher, Never> { return self.dictionaryPublisherSubject.eraseToAnyPublisher() } public private(set) var dictionaryPublisherSubject = CurrentValueSubject, Never>(Dictionary()) - public private(set) var myStringInBaseSetCallCount = 0 - @Published public var myStringInBase: String = "" { didSet { myStringInBaseSetCallCount += 1 } } +@Published public var myStringInBase: String = "" { didSet { myStringInBaseSetCallCount += 1 } } } """ diff --git a/Tests/TestDocComments/FixtureDocComment.swift b/Tests/TestDocComments/FixtureDocComment.swift index 46d8e0d6..6bcdd127 100644 --- a/Tests/TestDocComments/FixtureDocComment.swift +++ b/Tests/TestDocComments/FixtureDocComment.swift @@ -67,7 +67,7 @@ public class DocProtocolMock: DocProtocol { public private(set) var fooCallCount = 0 public var fooHandler: ((Bool, Int) -> ())? - public func foo(arg: Bool, tag: Int) { + public func foo(arg: Bool, tag: Int) { fooCallCount += 1 if let fooHandler = fooHandler { fooHandler(arg, tag) @@ -77,7 +77,7 @@ public class DocProtocolMock: DocProtocol { public private(set) var barCallCount = 0 public var barHandler: ((String, Float) -> ())? - public func bar(name: String, more: Float) { + public func bar(name: String, more: Float) { barCallCount += 1 if let barHandler = barHandler { barHandler(name, more) diff --git a/Tests/TestEmojis/EmojiTests.swift b/Tests/TestEmojis/EmojiTests.swift index 33188055..6e2fade4 100644 --- a/Tests/TestEmojis/EmojiTests.swift +++ b/Tests/TestEmojis/EmojiTests.swift @@ -1,7 +1,4 @@ -import Foundation - class EmojiTests: MockoloTestCase { - func testEmojis() { verify(srcContent: emojiVars, dstContent: emojiVarsMock) @@ -12,4 +9,10 @@ class EmojiTests: MockoloTestCase { mockContent: emojiParentMock, dstContent: emojiCombMock) } + + func testKrJp() { + verify(srcContent: krJp, + mockContent: krJpParentMock, + dstContent: krJpMock) + } } diff --git a/Tests/TestEmojis/FixtureEmojis.swift b/Tests/TestEmojis/FixtureEmojis.swift index 5efcbf3e..abae51ca 100644 --- a/Tests/TestEmojis/FixtureEmojis.swift +++ b/Tests/TestEmojis/FixtureEmojis.swift @@ -51,7 +51,7 @@ class EmojiVarsMock: EmojiVars { private(set) var 😂SetCallCount = 0 - private var _😂: Emoji! { didSet { 😂SetCallCount += 1 } } + private var _😂: Emoji! { didSet { 😂SetCallCount += 1 } } var 😂: Emoji { get { return _😂 } set { _😂 = newValue } @@ -64,7 +64,6 @@ class EmojiVarsMock: EmojiVars { let emojiCombMock = """ import Foundation - @available(iOS 10.0, *) class EmojiVarsMock: EmojiVars { init() { } @@ -77,7 +76,7 @@ class EmojiVarsMock: EmojiVars { private(set) var 😂SetCallCount = 0 - private var _😂: Emoji! { didSet { 😂SetCallCount += 1 } } + private var _😂: Emoji! { didSet { 😂SetCallCount += 1 } } var 😂: Emoji { get { return _😂 } set { _😂 = newValue } @@ -98,7 +97,6 @@ class EmojiVarsMock: EmojiVars { set { _👌😳👍 = newValue } } } - """ let familyEmoji = @@ -126,8 +124,7 @@ class FamilyEmojiMock: FamilyEmoji { } """ -let familyEmojiMock = -""" +let familyEmojiMock = """ class FamilyMock: Family { init() {} init(안녕하세요: String = "", 👪🏽: Int = 0) { @@ -161,16 +158,14 @@ class FamilyMock: Family { """ -let krJp = -""" +let krJp = """ /// \(String.mockAnnotation) protocol Hello: Hi { - var 天気が: String { get set } + var 天気: String { get set } } """ -let krJpParentMock = -""" +let krJpParentMock = """ class HiMock: Hi { init() {} init(연락하기: Int = 0) { @@ -186,39 +181,23 @@ class HiMock: Hi { } """ -let krJpMock = -""" - +let krJpMock = """ class HelloMock: Hello { - init() {} - init(天気が: String = "", 연락하기: Int = 0) { - self.天気が = 天気が + init() { } + init(天気: String = "", 연락하기: Int = 0) { + self.天気 = 天気 self.연락하기 = 연락하기 } - var 天気がSetCallCount = 0 - var underlying天気が: String = "" - var 天気が: String { - get { - return underlying天気が - } - set { - underlying天気が = newValue - 天気がSetCallCount += 1 - } - } + + private(set) var 天気SetCallCount = 0 + var 天気: String = "" { didSet { 天気SetCallCount += 1 } } var 연락하기SetCallCount = 0 - var underlying연락하기: Int = 0 + private var _연락하기: Int = 0 var 연락하기: Int { - get { - return underlying연락하기 - } - set { - underlying연락하기 = newValue - 연락하기SetCallCount += 1 - } + get { return _연락하기 } + set { _연락하기 = newValue } } } - """ diff --git a/Tests/TestExistentialAny/FixtureExistentialAny.swift b/Tests/TestExistentialAny/FixtureExistentialAny.swift index 032a613c..e8bc7378 100644 --- a/Tests/TestExistentialAny/FixtureExistentialAny.swift +++ b/Tests/TestExistentialAny/FixtureExistentialAny.swift @@ -25,28 +25,28 @@ class ExistentialAnyMock: ExistentialAny { - private var _foo: P! + private var _foo: P! var foo: P { get { return _foo } set { _foo = newValue } } - private var _bar: (any R)! + private var _bar: (any R)! var bar: any R { get { return _bar } set { _bar = newValue } } - private var _baz: (any P & Q)! + private var _baz: (any P & Q)! var baz: any P & Q { get { return _baz } set { _baz = newValue } } - private var _qux: ((any P) -> any P)! + private var _qux: ((any P) -> any P)! var qux: (any P) -> any P { get { return _qux } set { _qux = newValue } @@ -117,13 +117,13 @@ class UseSomeProtocolMock: UseSomeProtocol { private(set) var fooCallCount = 0 - var fooHandler: (() -> any SomeProtocol)? - func foo() -> any SomeProtocol { + var fooHandler: (() -> any SomeProtocol)? + func foo() -> any SomeProtocol { fooCallCount += 1 if let fooHandler = fooHandler { return fooHandler() } - return SomeProtocolMock() + return SomeProtocolMock() } } """ diff --git a/Tests/TestFuncs/TestBasicFuncs/FixtureNonSimpleFuncs.swift b/Tests/TestFuncs/TestBasicFuncs/FixtureNonSimpleFuncs.swift index 36712a91..e352aa64 100644 --- a/Tests/TestFuncs/TestBasicFuncs/FixtureNonSimpleFuncs.swift +++ b/Tests/TestFuncs/TestBasicFuncs/FixtureNonSimpleFuncs.swift @@ -18,7 +18,7 @@ public class FooMock: Foo { public private(set) var hashCallCount = 0 public var hashHandler: ((inout Hasher) -> ())? - public func hash(into hasher: inout Hasher) { + public func hash(into hasher: inout Hasher) { hashCallCount += 1 if let hashHandler = hashHandler { hashHandler(&hasher) @@ -28,7 +28,7 @@ public class FooMock: Foo { public private(set) var barCallCount = 0 public var barHandler: ((inout String, inout Int) -> ())? - public func bar(lhs: inout String, rhs: inout Int) { + public func bar(lhs: inout String, rhs: inout Int) { barCallCount += 1 if let barHandler = barHandler { barHandler(&lhs, &rhs) diff --git a/Tests/TestFuncs/TestFuncAsync/FixtureFuncAsync.swift b/Tests/TestFuncs/TestFuncAsync/FixtureFuncAsync.swift index a9f4c20d..b29efa9c 100644 --- a/Tests/TestFuncs/TestFuncAsync/FixtureFuncAsync.swift +++ b/Tests/TestFuncs/TestFuncAsync/FixtureFuncAsync.swift @@ -1,8 +1,6 @@ import MockoloFramework let funcAsync = """ -import Foundation - /// \(String.mockAnnotation) protocol FuncAsync { init() async @@ -15,12 +13,7 @@ protocol FuncAsync { } """ -let funcAsyncMock = -""" - -import Foundation - - +let funcAsyncMock = """ class FuncAsyncMock: FuncAsync { required init() async { @@ -39,12 +32,11 @@ class FuncAsyncMock: FuncAsync { private(set) var f2CallCount = 0 var f2Handler: ((Int) async -> ())? - func f2(arg: Int) async { + func f2(arg: Int) async { f2CallCount += 1 if let f2Handler = f2Handler { await f2Handler(arg) } - } private(set) var g1CallCount = 0 @@ -59,12 +51,11 @@ class FuncAsyncMock: FuncAsync { private(set) var g2CallCount = 0 var g2Handler: (((Int) async -> ()) async -> ())? - func g2(arg: (Int) async -> ()) async { + func g2(arg: (Int) async -> ()) async { g2CallCount += 1 if let g2Handler = g2Handler { await g2Handler(arg) } - } private(set) var updateCallCount = 0 @@ -77,12 +68,9 @@ class FuncAsyncMock: FuncAsync { fatalError("updateHandler returns can't have a default value thus its handler must be set") } } - """ let funcAsyncThrows = """ -import Foundation - /// \(String.mockAnnotation) protocol FuncAsyncThrows { init() async throws @@ -97,10 +85,6 @@ protocol FuncAsyncThrows { """ let funcAsyncThrowsMock = """ - -import Foundation - - class FuncAsyncThrowsMock: FuncAsyncThrows { required init() async throws { @@ -119,12 +103,11 @@ class FuncAsyncThrowsMock: FuncAsyncThrows { private(set) var f2CallCount = 0 var f2Handler: ((Int) async throws -> ())? - func f2(arg: Int) async throws { + func f2(arg: Int) async throws { f2CallCount += 1 if let f2Handler = f2Handler { try await f2Handler(arg) } - } private(set) var g1CallCount = 0 @@ -139,12 +122,11 @@ class FuncAsyncThrowsMock: FuncAsyncThrows { private(set) var g2CallCount = 0 var g2Handler: (((Int) async throws -> ()) async throws -> ())? - func g2(arg: (Int) async throws -> ()) async throws { + func g2(arg: (Int) async throws -> ()) async throws { g2CallCount += 1 if let g2Handler = g2Handler { try await g2Handler(arg) } - } private(set) var updateCallCount = 0 @@ -157,5 +139,4 @@ class FuncAsyncThrowsMock: FuncAsyncThrows { fatalError("updateHandler returns can't have a default value thus its handler must be set") } } - """ diff --git a/Tests/TestFuncs/TestFuncThrow/FixtureFuncThrow.swift b/Tests/TestFuncs/TestFuncThrow/FixtureFuncThrow.swift index 947d25a1..ea33fcba 100644 --- a/Tests/TestFuncs/TestFuncThrow/FixtureFuncThrow.swift +++ b/Tests/TestFuncs/TestFuncThrow/FixtureFuncThrow.swift @@ -22,8 +22,7 @@ protocol FuncThrow { } """ -let funcThrowMock = -""" +let funcThrowMock = """ import Foundation @@ -43,22 +42,20 @@ class FuncThrowMock: FuncThrow { private(set) var f2CallCount = 0 var f2Handler: ((Int) throws -> ())? - func f2(arg: Int) throws { + func f2(arg: Int) throws { f2CallCount += 1 if let f2Handler = f2Handler { try f2Handler(arg) } - } private(set) var f3CallCount = 0 var f3Handler: ((Int) throws(SomeError) -> ())? - func f3(arg: Int) throws(SomeError) { + func f3(arg: Int) throws(SomeError) { f3CallCount += 1 if let f3Handler = f3Handler { try f3Handler(arg) } - } private(set) var f4CallCount = 0 @@ -73,22 +70,20 @@ class FuncThrowMock: FuncThrow { private(set) var f5CallCount = 0 var f5Handler: (() throws(MyError) -> ())? - func f5() throws(MyError) { + func f5() throws(MyError) { f5CallCount += 1 if let f5Handler = f5Handler { try f5Handler() } - } private(set) var f6CallCount = 0 var f6Handler: (() async throws(any Error) -> ())? - func f6() async throws(any Error) { + func f6() async throws(any Error) { f6CallCount += 1 if let f6Handler = f6Handler { try await f6Handler() } - } private(set) var g1CallCount = 0 @@ -103,12 +98,11 @@ class FuncThrowMock: FuncThrow { private(set) var g2CallCount = 0 var g2Handler: (((Int) throws -> ()) throws -> ())? - func g2(arg: (Int) throws -> ()) throws { + func g2(arg: (Int) throws -> ()) throws { g2CallCount += 1 if let g2Handler = g2Handler { try g2Handler(arg) } - } private(set) var hCallCount = 0 @@ -151,6 +145,4 @@ class FuncThrowMock: FuncThrow { fatalError("updateArg1Handler returns can't have a default value thus its handler must be set") } } - - """ diff --git a/Tests/TestFuncs/TestGenericFuncs/FixtureGenericFunc.swift b/Tests/TestFuncs/TestGenericFuncs/FixtureGenericFunc.swift index b4304237..44913992 100644 --- a/Tests/TestFuncs/TestGenericFuncs/FixtureGenericFunc.swift +++ b/Tests/TestFuncs/TestGenericFuncs/FixtureGenericFunc.swift @@ -81,7 +81,7 @@ class GenericFuncMock: GenericFunc { private(set) var sendEventsCallCount = 0 var sendEventsHandler: (([SomeEvent], Any, Bool, Any) -> ())? - func sendEvents(events: [SomeEvent], value: T, once: Bool, closure: @escaping (T) -> ()) { + func sendEvents(events: [SomeEvent], value: T, once: Bool, closure: @escaping (T) -> ()) { sendEventsCallCount += 1 if let sendEventsHandler = sendEventsHandler { sendEventsHandler(events, value, once, closure) @@ -131,7 +131,7 @@ class GenericFuncMock: GenericFunc { private(set) var pullCallCount = 0 var pullHandler: (([SomeEvent], Any, Bool, Any) -> ())? - func pull(events: [SomeEvent], value: T, once: Bool, closure: @escaping (T?) -> ()) { + func pull(events: [SomeEvent], value: T, once: Bool, closure: @escaping (T?) -> ()) { pullCallCount += 1 if let pullHandler = pullHandler { pullHandler(events, value, once, closure) @@ -141,7 +141,7 @@ class GenericFuncMock: GenericFunc { private(set) var pullEventsCallCount = 0 var pullEventsHandler: (([SomeEvent], Any?, @escaping () -> ()) -> ())? - func pull(events: [SomeEvent], until: U?, closure: @escaping () -> ()) { + func pull(events: [SomeEvent], until: U?, closure: @escaping () -> ()) { pullEventsCallCount += 1 if let pullEventsHandler = pullEventsHandler { pullEventsHandler(events, until, closure) @@ -151,7 +151,7 @@ class GenericFuncMock: GenericFunc { private(set) var optionalPullCallCount = 0 var optionalPullHandler: (([SomeEvent], Any, Bool, ((Any?) -> ())?) -> ())? - func optionalPull(events: [SomeEvent], value: T, once: Bool, closure: ((T?) -> ())?) { + func optionalPull(events: [SomeEvent], value: T, once: Bool, closure: ((T?) -> ())?) { optionalPullCallCount += 1 if let optionalPullHandler = optionalPullHandler { optionalPullHandler(events, value, once, closure as? ((Any?) -> ())) @@ -161,7 +161,7 @@ class GenericFuncMock: GenericFunc { private(set) var addCallCount = 0 var addHandler: ((Any, Any?) -> ())? - func add(n1: T, n2: T?) { + func add(n1: T, n2: T?) { addCallCount += 1 if let addHandler = addHandler { addHandler(n1, n2) @@ -171,7 +171,7 @@ class GenericFuncMock: GenericFunc { private(set) var addACallCount = 0 var addAHandler: ((Any?, Any?) -> ())? - func add(a: T?, b: T?) { + func add(a: T?, b: T?) { addACallCount += 1 if let addAHandler = addAHandler { addAHandler(a, b) @@ -181,7 +181,7 @@ class GenericFuncMock: GenericFunc { private(set) var addABCallCount = 0 var addABHandler: ((Any, Any) -> ())? - func add(a: T, b: T) { + func add(a: T, b: T) { addABCallCount += 1 if let addABHandler = addABHandler { addABHandler(a, b) @@ -246,42 +246,38 @@ class StoringMock: Storing { private(set) var connectCallCount = 0 var connectHandler: ((Any) -> ())? - func connect(adapter: T) where T: Adapter { + func connect(adapter: T) where T: Adapter { connectCallCount += 1 if let connectHandler = connectHandler { connectHandler(adapter) } - } private(set) var connectAdapterCallCount = 0 var connectAdapterHandler: ((Any) -> ())? - func connect(adapter: T) where T: KeyedAdapter { + func connect(adapter: T) where T: KeyedAdapter { connectAdapterCallCount += 1 if let connectAdapterHandler = connectAdapterHandler { connectAdapterHandler(adapter) } - } private(set) var connectAdapterTCallCount = 0 var connectAdapterTHandler: ((Any) -> ())? - func connect(adapter: T) where T: KeyedAdapter2 { + func connect(adapter: T) where T: KeyedAdapter2 { connectAdapterTCallCount += 1 if let connectAdapterTHandler = connectAdapterTHandler { connectAdapterTHandler(adapter) } - } private(set) var connectAdapterTTKeyedAdapter3CallCount = 0 var connectAdapterTTKeyedAdapter3Handler: ((Any) -> ())? - func connect(adapter: T) where T: KeyedAdapter3 { + func connect(adapter: T) where T: KeyedAdapter3 { connectAdapterTTKeyedAdapter3CallCount += 1 if let connectAdapterTTKeyedAdapter3Handler = connectAdapterTTKeyedAdapter3Handler { connectAdapterTTKeyedAdapter3Handler(adapter) } - } } """ @@ -303,42 +299,38 @@ class StoringMock: Storing { private(set) var connectCallCount = 0 var connectHandler: ((Any) -> ())? - func connect(adapter: T) where T: Adapter, T.Element == S.Element { + func connect(adapter: T) where T: Adapter, T.Element == S.Element { connectCallCount += 1 if let connectHandler = connectHandler { connectHandler(adapter) } - } private(set) var connectAdapterCallCount = 0 var connectAdapterHandler: ((Any) -> ())? - func connect(adapter: T) where T: KeyedAdapter, T.Element == S.Element { + func connect(adapter: T) where T: KeyedAdapter, T.Element == S.Element { connectAdapterCallCount += 1 if let connectAdapterHandler = connectAdapterHandler { connectAdapterHandler(adapter) } - } private(set) var connectAdapterTCallCount = 0 var connectAdapterTHandler: ((Any) -> ())? - func connect(adapter: T) where T: KeyedAdapter2, T.Element == S.Element { + func connect(adapter: T) where T: KeyedAdapter2, T.Element == S.Element { connectAdapterTCallCount += 1 if let connectAdapterTHandler = connectAdapterTHandler { connectAdapterTHandler(adapter) } - } private(set) var connectAdapterTTKeyedAdapter3TElementSElementCallCount = 0 var connectAdapterTTKeyedAdapter3TElementSElementHandler: ((Any) -> ())? - func connect(adapter: T) where T: KeyedAdapter3, T.Element == S.Element { + func connect(adapter: T) where T: KeyedAdapter3, T.Element == S.Element { connectAdapterTTKeyedAdapter3TElementSElementCallCount += 1 if let connectAdapterTTKeyedAdapter3TElementSElementHandler = connectAdapterTTKeyedAdapter3TElementSElementHandler { connectAdapterTTKeyedAdapter3TElementSElementHandler(adapter) } - } } """ diff --git a/Tests/TestFuncs/TestOpaqueTypeFuncs/FixtureOpaqueTypeFunc.swift b/Tests/TestFuncs/TestOpaqueTypeFuncs/FixtureOpaqueTypeFunc.swift index 774d316d..e866d808 100644 --- a/Tests/TestFuncs/TestOpaqueTypeFuncs/FixtureOpaqueTypeFunc.swift +++ b/Tests/TestFuncs/TestOpaqueTypeFuncs/FixtureOpaqueTypeFunc.swift @@ -27,7 +27,7 @@ public class OpaqueTypeProtocolMock: OpaqueTypeProtocol { public private(set) var optionalCallCount = 0 public var optionalHandler: ((Any?) -> ())? - public func optional(_ type: (some Error)?) { + public func optional(_ type: (some Error)?) { optionalCallCount += 1 if let optionalHandler = optionalHandler { optionalHandler(type) @@ -68,7 +68,7 @@ public class OpaqueTypeWithMultiTypeProtocolMock: OpaqueTypeWithMultiTypeProtoco public private(set) var optionalCallCount = 0 public var optionalHandler: ((Any?) -> ())? - public func optional(_ type: ((some (Error & Foo)))?) { + public func optional(_ type: ((some (Error & Foo)))?) { optionalCallCount += 1 if let optionalHandler = optionalHandler { optionalHandler(type) @@ -78,7 +78,7 @@ public class OpaqueTypeWithMultiTypeProtocolMock: OpaqueTypeWithMultiTypeProtoco public private(set) var multiParamCallCount = 0 public var multiParamHandler: ((Any, Any) -> ())? - public func multiParam(_ typeA: some Error, _ typeB: some Error) { + public func multiParam(_ typeA: some Error, _ typeB: some Error) { multiParamCallCount += 1 if let multiParamHandler = multiParamHandler { multiParamHandler(typeA, typeB) @@ -107,7 +107,7 @@ class ProtocolReturningOpaqueTypeInClosureProtocolMock: ProtocolReturningOpaqueT private(set) var registerCallCount = 0 var registerHandler: ((@autoclosure @escaping () -> (any MyAwesomeType)) -> ())? - func register(router: @autoclosure @escaping () -> (some MyAwesomeType)) { + func register(router: @autoclosure @escaping () -> (some MyAwesomeType)) { registerCallCount += 1 if let registerHandler = registerHandler { registerHandler(router()) diff --git a/Tests/TestInit/FixtureInit.swift b/Tests/TestInit/FixtureInit.swift index 4d3338aa..ab86fba7 100644 --- a/Tests/TestInit/FixtureInit.swift +++ b/Tests/TestInit/FixtureInit.swift @@ -223,11 +223,8 @@ public typealias ForcastCheckBlock = () -> ForcastUpdateConfig? let nonSimpleInitVarsMock = """ - - - public class ForcastUpdatingMock: ForcastUpdating { - private var _checkBlock: ForcastCheckBlock! + private var _checkBlock: ForcastCheckBlock! private var _dataStream: DataStream! public init() { } required public init(checkBlock: @escaping ForcastCheckBlock, dataStream: DataStream) { @@ -258,12 +255,11 @@ public class ForcastUpdatingMock: ForcastUpdating { public private(set) var fetchInfoCallCount = 0 public var fetchInfoHandler: ((URL, @escaping (String?, URL?) -> ()) -> ())? - public func fetchInfo(fromItmsURL itmsURL: URL, completionHandler: @escaping (String?, URL?) -> ()) { + public func fetchInfo(fromItmsURL itmsURL: URL, completionHandler: @escaping (String?, URL?) -> ()) { fetchInfoCallCount += 1 if let fetchInfoHandler = fetchInfoHandler { fetchInfoHandler(itmsURL, completionHandler) } - } } """ @@ -278,11 +274,8 @@ protocol MyProtocol { """ let initWithSameParamNameButDifferentTypeMock = """ - - - class MyProtocolMock: MyProtocol { - private var _param: Any! + private var _param: Any! init() { } required init(param: Any) { self._param = param @@ -293,8 +286,6 @@ class MyProtocolMock: MyProtocol { required init(with param: [Character] = [Character]()) { self._param = param } - - } """ @@ -307,11 +298,8 @@ protocol MyProtocol { """ let multipleInitsWithSameParamNameMock = """ - - - class MyProtocolMock: MyProtocol { - private var _anotherParam: Any! + private var _anotherParam: Any! private var _param: String! init() { } required init(param: String = "", anotherParam: Int = 0) { @@ -350,7 +338,7 @@ class MyProtocolMock: MyProtocol { let typedThrowableInit = """ /// \(String.mockAnnotation) protocol MyProtocol { - init(param: String) throws(SomeError) + init(param: String) throws(SomeError) } """ @@ -359,10 +347,10 @@ let typedThrowableInitMock = """ class MyProtocolMock: MyProtocol { - private var _param: String! - init() { } - required init(param: String = "") throws(SomeError) { - self._param = param - } + private var _param: String! + init() { } + required init(param: String = "") throws(SomeError) { + self._param = param + } } """ diff --git a/Tests/TestMacros/FixtureMacro.swift b/Tests/TestMacros/FixtureMacro.swift index 356a5769..ec1bb0f8 100644 --- a/Tests/TestMacros/FixtureMacro.swift +++ b/Tests/TestMacros/FixtureMacro.swift @@ -34,7 +34,7 @@ public class SomeProtocolMock: SomeProtocol { public private(set) var runCallCount = 0 public var runHandler: (() -> ())? - public func run() { + public func run() { runCallCount += 1 if let runHandler = runHandler { runHandler() @@ -72,7 +72,7 @@ public class SomeProtocolMock: SomeProtocol { public private(set) var runCallCount = 0 public var runHandler: (() -> ())? - public func run() { + public func run() { runCallCount += 1 if let runHandler = runHandler { runHandler() @@ -116,7 +116,7 @@ public class SomeProtocolMock: SomeProtocol { public private(set) var runCallCount = 0 public var runHandler: (() -> ())? - public func run() { + public func run() { runCallCount += 1 if let runHandler = runHandler { runHandler() @@ -167,7 +167,7 @@ public class SomeProtocolMock: SomeProtocol { public private(set) var runCallCount = 0 public var runHandler: (() -> ())? - public func run() { + public func run() { runCallCount += 1 if let runHandler = runHandler { runHandler() @@ -217,7 +217,7 @@ public class SomeProtocolMock: SomeProtocol { public private(set) var runCallCount = 0 public var runHandler: (() -> ())? - public func run() { + public func run() { runCallCount += 1 if let runHandler = runHandler { runHandler() @@ -248,7 +248,7 @@ class PresentableListenerMock: PresentableListener { private(set) var runCallCount = 0 var runHandler: (() -> ())? - func run() { + func run() { runCallCount += 1 if let runHandler = runHandler { runHandler() @@ -259,7 +259,7 @@ class PresentableListenerMock: PresentableListener { private(set) var showDebugModeCallCount = 0 var showDebugModeHandler: (() -> ())? - func showDebugMode() { + func showDebugMode() { showDebugModeCallCount += 1 if let showDebugModeHandler = showDebugModeHandler { showDebugModeHandler() diff --git a/Tests/TestModifiersTypes/FixtureModifiersTypes.swift b/Tests/TestModifiersTypes/FixtureModifiersTypes.swift index 56ced15b..d4215bcc 100644 --- a/Tests/TestModifiersTypes/FixtureModifiersTypes.swift +++ b/Tests/TestModifiersTypes/FixtureModifiersTypes.swift @@ -21,7 +21,7 @@ class FooMock: Foo { private(set) var barFuncCallCount = 0 var barFuncHandler: (([Int]) -> ())? - func barFunc(val: [Int]) { + func barFunc(val: [Int]) { barFuncCallCount += 1 if let barFuncHandler = barFuncHandler { barFuncHandler(val) @@ -31,7 +31,7 @@ class FooMock: Foo { private(set) var bazFuncCallCount = 0 var bazFuncHandler: ((String, Float) -> ())? - func bazFunc(arg: String, other: Float) { + func bazFunc(arg: String, other: Float) { bazFuncCallCount += 1 if let bazFuncHandler = bazFuncHandler { bazFuncHandler(arg, other) @@ -64,7 +64,7 @@ class FooMock: Foo { private(set) var barFuncCallCount = 0 var barFuncHandler: (([Int]) -> ())? - func barFunc(val: [Int]) { + func barFunc(val: [Int]) { barFuncCallCount += 1 if let barFuncHandler = barFuncHandler { barFuncHandler(val) @@ -74,7 +74,7 @@ class FooMock: Foo { private(set) var bazFuncCallCount = 0 var bazFuncHandler: ((String, Float) -> ())? - func bazFunc(arg: String, other: Float) { + func bazFunc(arg: String, other: Float) { bazFuncCallCount += 1 if let bazFuncHandler = bazFuncHandler { bazFuncHandler(arg, other) @@ -107,7 +107,7 @@ class FooMock: Foo { private(set) var barFuncCallCount = 0 var barFuncHandler: (([Int]) -> ())? - dynamic func barFunc(val: [Int]) { + dynamic func barFunc(val: [Int]) { barFuncCallCount += 1 if let barFuncHandler = barFuncHandler { barFuncHandler(val) @@ -117,7 +117,7 @@ class FooMock: Foo { private(set) var bazFuncCallCount = 0 var bazFuncHandler: ((String, Float) -> ())? - func bazFunc(arg: String, other: Float) { + func bazFunc(arg: String, other: Float) { bazFuncCallCount += 1 if let bazFuncHandler = bazFuncHandler { bazFuncHandler(arg, other) diff --git a/Tests/TestNamespaces/FixtureNestedProtocol.swift b/Tests/TestNamespaces/FixtureNestedProtocol.swift index cb35f0a9..56b3dadb 100644 --- a/Tests/TestNamespaces/FixtureNestedProtocol.swift +++ b/Tests/TestNamespaces/FixtureNestedProtocol.swift @@ -78,8 +78,8 @@ class OKMock: OK { typealias T = Any private(set) var requirementCallCount = 0 - var requirementHandler: (() -> T)? - func requirement() -> T { + var requirementHandler: (() -> T)? + func requirement() -> T { requirementCallCount += 1 if let requirementHandler = requirementHandler { return requirementHandler() diff --git a/Tests/TestOverloads/FixtureDuplicates1.swift b/Tests/TestOverloads/FixtureDuplicates1.swift index a09d2a5d..5dbdcd4e 100644 --- a/Tests/TestOverloads/FixtureDuplicates1.swift +++ b/Tests/TestOverloads/FixtureDuplicates1.swift @@ -28,7 +28,7 @@ class FooMock: Foo { private(set) var displayCallCount = 0 var displayHandler: (() -> ())? - func display() { + func display() { displayCallCount += 1 if let displayHandler = displayHandler { displayHandler() @@ -38,7 +38,7 @@ class FooMock: Foo { private(set) var displayXCallCount = 0 var displayXHandler: ((Int) -> ())? - func display(x: Int) { + func display(x: Int) { displayXCallCount += 1 if let displayXHandler = displayXHandler { displayXHandler(x) @@ -48,7 +48,7 @@ class FooMock: Foo { private(set) var displayYCallCount = 0 var displayYHandler: ((Int) -> ())? - func display(y: Int) { + func display(y: Int) { displayYCallCount += 1 if let displayYHandler = displayYHandler { displayYHandler(y) @@ -58,7 +58,7 @@ class FooMock: Foo { private(set) var updateCallCount = 0 var updateHandler: (() -> ())? - func update() { + func update() { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler() @@ -78,7 +78,7 @@ class FooMock: Foo { private(set) var updateArgCallCount = 0 var updateArgHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateArgCallCount += 1 if let updateArgHandler = updateArgHandler { updateArgHandler(arg) @@ -88,7 +88,7 @@ class FooMock: Foo { private(set) var updateArgFloatCallCount = 0 var updateArgFloatHandler: ((Float) -> ())? - func update(arg: Float) { + func update(arg: Float) { updateArgFloatCallCount += 1 if let updateArgFloatHandler = updateArgFloatHandler { updateArgFloatHandler(arg) diff --git a/Tests/TestOverloads/FixtureDuplicates2.swift b/Tests/TestOverloads/FixtureDuplicates2.swift index b6f6aac8..f04e8254 100644 --- a/Tests/TestOverloads/FixtureDuplicates2.swift +++ b/Tests/TestOverloads/FixtureDuplicates2.swift @@ -28,7 +28,7 @@ class FooMock: Foo { private(set) var updateCallCount = 0 var updateHandler: ((Int, Float) -> ())? - func update(arg: Int, some: Float) { + func update(arg: Int, some: Float) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(arg, some) diff --git a/Tests/TestOverloads/FixtureDuplicates3.swift b/Tests/TestOverloads/FixtureDuplicates3.swift index 84f4f020..378bfdcd 100644 --- a/Tests/TestOverloads/FixtureDuplicates3.swift +++ b/Tests/TestOverloads/FixtureDuplicates3.swift @@ -35,7 +35,7 @@ class FooMock: Foo { private(set) var collectionViewConfigureCellCallCount = 0 var collectionViewConfigureCellHandler: ((UICollectionView, UICollectionViewCell, Int) -> ())? - func collectionView(_ collectionView: UICollectionView, configureCell cell: UICollectionViewCell, forItemAt index: Int) { + func collectionView(_ collectionView: UICollectionView, configureCell cell: UICollectionViewCell, forItemAt index: Int) { collectionViewConfigureCellCallCount += 1 if let collectionViewConfigureCellHandler = collectionViewConfigureCellHandler { collectionViewConfigureCellHandler(collectionView, cell, index) @@ -55,7 +55,7 @@ class FooMock: Foo { private(set) var collectionViewDidEndDisplayingCallCount = 0 var collectionViewDidEndDisplayingHandler: ((UICollectionView, UICollectionViewCell, Int) -> ())? - func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt index: Int) { + func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt index: Int) { collectionViewDidEndDisplayingCallCount += 1 if let collectionViewDidEndDisplayingHandler = collectionViewDidEndDisplayingHandler { collectionViewDidEndDisplayingHandler(collectionView, cell, index) @@ -65,7 +65,7 @@ class FooMock: Foo { private(set) var collectionViewConfigureCallCount = 0 var collectionViewConfigureHandler: ((UICollectionView, UICollectionViewCell, Int) -> ())? - func collectionView(_ collectionView: UICollectionView, configure cell: UICollectionViewCell, forItemAt index: Int) { + func collectionView(_ collectionView: UICollectionView, configure cell: UICollectionViewCell, forItemAt index: Int) { collectionViewConfigureCallCount += 1 if let collectionViewConfigureHandler = collectionViewConfigureHandler { collectionViewConfigureHandler(collectionView, cell, index) diff --git a/Tests/TestOverloads/FixtureDuplicates4.swift b/Tests/TestOverloads/FixtureDuplicates4.swift index cfb8ccbd..6b3386cb 100644 --- a/Tests/TestOverloads/FixtureDuplicates4.swift +++ b/Tests/TestOverloads/FixtureDuplicates4.swift @@ -20,7 +20,7 @@ class SomeVCMock: SomeVC { private(set) var popViewControllerCallCount = 0 var popViewControllerHandler: ((UIViewController) -> ())? - func popViewController(viewController: UIViewController) { + func popViewController(viewController: UIViewController) { popViewControllerCallCount += 1 if let popViewControllerHandler = popViewControllerHandler { popViewControllerHandler(viewController) @@ -30,7 +30,7 @@ class SomeVCMock: SomeVC { private(set) var popViewController1CallCount = 0 var popViewController1Handler: (() -> ())? - func popViewController() { + func popViewController() { popViewController1CallCount += 1 if let popViewController1Handler = popViewController1Handler { popViewController1Handler() @@ -77,7 +77,7 @@ public class FooMock: Foo { public private(set) var customizeCallCount = 0 public var customizeHandler: ((String?) -> ())? - public func customize(text: String?) { + public func customize(text: String?) { customizeCallCount += 1 if let customizeHandler = customizeHandler { customizeHandler(text) @@ -87,7 +87,7 @@ public class FooMock: Foo { public private(set) var customizeTextCallCount = 0 public var customizeTextHandler: ((String?, UIColor?) -> ())? - public func customize(text: String?, textColor: UIColor?) { + public func customize(text: String?, textColor: UIColor?) { customizeTextCallCount += 1 if let customizeTextHandler = customizeTextHandler { customizeTextHandler(text, textColor) @@ -97,7 +97,7 @@ public class FooMock: Foo { public private(set) var customizeTextTextColorCallCount = 0 public var customizeTextTextColorHandler: ((String?, UIColor?, String?) -> ())? - public func customize(text: String?, textColor: UIColor?, loadId: String?) { + public func customize(text: String?, textColor: UIColor?, loadId: String?) { customizeTextTextColorCallCount += 1 if let customizeTextTextColorHandler = customizeTextTextColorHandler { customizeTextTextColorHandler(text, textColor, loadId) @@ -121,40 +121,34 @@ func talk(_ dismiss: Bool) """ let sameNameVarFuncMock = """ - public class BarMock: Bar { - - - - public init() { } + public init() { } public init(talk: Int = 0) { self.talk = talk - } + + public var talk: Int = 0 } public class FooMock: Foo { - - - - public init() { } + public init() { } public init(talk: Int = 0) { self.talk = talk - } + + public var talk: Int = 0 + public private(set) var talkDismissCallCount = 0 public var talkDismissHandler: ((Bool) -> ())? - public func talk(_ dismiss: Bool) { + public func talk(_ dismiss: Bool) { talkDismissCallCount += 1 if let talkDismissHandler = talkDismissHandler { talkDismissHandler(dismiss) } - } } - """ diff --git a/Tests/TestOverloads/FixtureDuplicates5.swift b/Tests/TestOverloads/FixtureDuplicates5.swift index 236a0166..dc40b918 100644 --- a/Tests/TestOverloads/FixtureDuplicates5.swift +++ b/Tests/TestOverloads/FixtureDuplicates5.swift @@ -24,7 +24,7 @@ public class SimpleDuplicateMock: SimpleDuplicate { public private(set) var removeCallCount = 0 public var removeHandler: ((Int) -> ())? - public func remove(_ arg: Int) { + public func remove(_ arg: Int) { removeCallCount += 1 if let removeHandler = removeHandler { removeHandler(arg) @@ -34,7 +34,7 @@ public class SimpleDuplicateMock: SimpleDuplicate { public private(set) var removeArgCallCount = 0 public var removeArgHandler: ((String) -> ())? - public func remove(_ arg: String) { + public func remove(_ arg: String) { removeArgCallCount += 1 if let removeArgHandler = removeArgHandler { removeArgHandler(arg) @@ -44,7 +44,7 @@ public class SimpleDuplicateMock: SimpleDuplicate { public private(set) var removeArgFloatCallCount = 0 public var removeArgFloatHandler: ((Float) -> ())? - public func remove(_ arg: Float) { + public func remove(_ arg: Float) { removeArgFloatCallCount += 1 if let removeArgFloatHandler = removeArgFloatHandler { removeArgFloatHandler(arg) @@ -54,7 +54,7 @@ public class SimpleDuplicateMock: SimpleDuplicate { public private(set) var removeArgDoubleCallCount = 0 public var removeArgDoubleHandler: ((Double) -> ())? - public func remove(_ arg: Double) { + public func remove(_ arg: Double) { removeArgDoubleCallCount += 1 if let removeArgDoubleHandler = removeArgDoubleHandler { removeArgDoubleHandler(arg) @@ -64,7 +64,7 @@ public class SimpleDuplicateMock: SimpleDuplicate { public private(set) var pushCallCount = 0 public var pushHandler: ((Double, Int, Float?) -> ())? - public func push(state: Double, attachTransition: Int, detachTransition: Float?) { + public func push(state: Double, attachTransition: Int, detachTransition: Float?) { pushCallCount += 1 if let pushHandler = pushHandler { pushHandler(state, attachTransition, detachTransition) @@ -74,7 +74,7 @@ public class SimpleDuplicateMock: SimpleDuplicate { public private(set) var pushStateCallCount = 0 public var pushStateHandler: ((Double, Float, Int, Float?) -> ())? - public func push(state: Double, flag: Float, attachTransition: Int, detachTransition: Float?) { + public func push(state: Double, flag: Float, attachTransition: Int, detachTransition: Float?) { pushStateCallCount += 1 if let pushStateHandler = pushStateHandler { pushStateHandler(state, flag, attachTransition, detachTransition) diff --git a/Tests/TestOverloads/FixtureDuplicatesInheritance2.swift b/Tests/TestOverloads/FixtureDuplicatesInheritance2.swift index 5f8e22cf..3c1cb51b 100644 --- a/Tests/TestOverloads/FixtureDuplicatesInheritance2.swift +++ b/Tests/TestOverloads/FixtureDuplicatesInheritance2.swift @@ -22,7 +22,7 @@ class FooMock: Foo { private(set) var updateCallCount = 0 var updateHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(arg) @@ -37,7 +37,7 @@ class BarMock: Bar { private(set) var updateCallCount = 0 var updateHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(arg) diff --git a/Tests/TestOverloads/FixtureDuplicatesInheritance3.swift b/Tests/TestOverloads/FixtureDuplicatesInheritance3.swift index abfdc087..6d6c25b8 100644 --- a/Tests/TestOverloads/FixtureDuplicatesInheritance3.swift +++ b/Tests/TestOverloads/FixtureDuplicatesInheritance3.swift @@ -28,7 +28,7 @@ class FooMock: Foo { private(set) var updateCallCount = 0 var updateHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(arg) @@ -43,7 +43,7 @@ class BarMock: Bar { private(set) var updateCallCount = 0 var updateHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(arg) @@ -58,7 +58,7 @@ class BazMock: Baz { private(set) var updateCallCount = 0 var updateHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(arg) diff --git a/Tests/TestOverloads/FixtureDuplicatesInheritance4.swift b/Tests/TestOverloads/FixtureDuplicatesInheritance4.swift index 44814c90..fda9fe63 100644 --- a/Tests/TestOverloads/FixtureDuplicatesInheritance4.swift +++ b/Tests/TestOverloads/FixtureDuplicatesInheritance4.swift @@ -31,7 +31,7 @@ class FooMock: Foo { var updateCallCount = 0 var updateHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateCallCount += 1 if let updateHandler = updateHandler { @@ -52,7 +52,7 @@ class BarMock: Bar { var updateCallCount = 0 var updateHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateCallCount += 1 if let updateHandler = updateHandler { @@ -73,7 +73,7 @@ class BazMock: Baz { var updateCallCount = 0 var updateHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateCallCount += 1 if let updateHandler = updateHandler { diff --git a/Tests/TestOverloads/FixtureDuplicatesInheritance5.swift b/Tests/TestOverloads/FixtureDuplicatesInheritance5.swift index 26a79405..e1bcb20b 100644 --- a/Tests/TestOverloads/FixtureDuplicatesInheritance5.swift +++ b/Tests/TestOverloads/FixtureDuplicatesInheritance5.swift @@ -32,7 +32,7 @@ class FooMock: Foo { private(set) var updateCallCount = 0 var updateHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(arg) @@ -42,7 +42,7 @@ class FooMock: Foo { private(set) var updateArgCallCount = 0 var updateArgHandler: ((Float) -> ())? - func update(arg: Float) { + func update(arg: Float) { updateArgCallCount += 1 if let updateArgHandler = updateArgHandler { updateArgHandler(arg) @@ -52,7 +52,7 @@ class FooMock: Foo { private(set) var displayCallCount = 0 var displayHandler: ((String) -> ())? - func display(param: String) { + func display(param: String) { displayCallCount += 1 if let displayHandler = displayHandler { displayHandler(param) @@ -67,7 +67,7 @@ class BarMock: Bar { private(set) var updateArgCallCount = 0 var updateArgHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateArgCallCount += 1 if let updateArgHandler = updateArgHandler { updateArgHandler(arg) @@ -77,7 +77,7 @@ class BarMock: Bar { private(set) var displayParamCallCount = 0 var displayParamHandler: ((String) -> ())? - func display(param: String) { + func display(param: String) { displayParamCallCount += 1 if let displayParamHandler = displayParamHandler { displayParamHandler(param) @@ -87,7 +87,7 @@ class BarMock: Bar { private(set) var updateCallCount = 0 var updateHandler: ((Float) -> ())? - func update(arg: Float) { + func update(arg: Float) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(arg) @@ -97,7 +97,7 @@ class BarMock: Bar { private(set) var displayCallCount = 0 var displayHandler: ((Double) -> ())? - func display(param: Double) { + func display(param: Double) { displayCallCount += 1 if let displayHandler = displayHandler { displayHandler(param) @@ -112,7 +112,7 @@ class BazMock: Baz { private(set) var updateCallCount = 0 var updateHandler: ((Int) -> ())? - func update(arg: Int) { + func update(arg: Int) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(arg) @@ -122,7 +122,7 @@ class BazMock: Baz { private(set) var updateArgCallCount = 0 var updateArgHandler: ((Float) -> ())? - func update(arg: Float) { + func update(arg: Float) { updateArgCallCount += 1 if let updateArgHandler = updateArgHandler { updateArgHandler(arg) @@ -132,7 +132,7 @@ class BazMock: Baz { private(set) var displayParamStringCallCount = 0 var displayParamStringHandler: ((String) -> ())? - func display(param: String) { + func display(param: String) { displayParamStringCallCount += 1 if let displayParamStringHandler = displayParamStringHandler { displayParamStringHandler(param) @@ -142,7 +142,7 @@ class BazMock: Baz { private(set) var displayCallCount = 0 var displayHandler: ((Double) -> ())? - func display(param: Double) { + func display(param: Double) { displayCallCount += 1 if let displayHandler = displayHandler { displayHandler(param) @@ -152,7 +152,7 @@ class BazMock: Baz { private(set) var displayParamCallCount = 0 var displayParamHandler: ((Int) -> ())? - func display(param: Int) { + func display(param: Int) { displayParamCallCount += 1 if let displayParamHandler = displayParamHandler { displayParamHandler(param) @@ -162,7 +162,7 @@ class BazMock: Baz { private(set) var showCallCount = 0 var showHandler: ((String) -> ())? - func show(param: String) { + func show(param: String) { showCallCount += 1 if let showHandler = showHandler { showHandler(param) diff --git a/Tests/TestOverloads/FixtureFuncOverload1.swift b/Tests/TestOverloads/FixtureFuncOverload1.swift index bbaaed08..86731b96 100644 --- a/Tests/TestOverloads/FixtureFuncOverload1.swift +++ b/Tests/TestOverloads/FixtureFuncOverload1.swift @@ -19,55 +19,46 @@ public class P0Mock: P0 { } var updateCallCount = 0 var updateHandler: (([String], Bool, @escaping () -> ()) -> ())? - func update(arg: [String], once: Bool, closure: @escaping () -> ()) { + func update(arg: [String], once: Bool, closure: @escaping () -> ()) { updateCallCount += 1 if let updateHandler = updateHandler { return updateHandler(arg, once, closure) } - } var updateArgCallCount = 0 var updateArgHandler: (([String], Any, Bool, Any) -> ())? - func update(arg: [String], value: T, once: Bool, closure: @escaping (T) -> ()) { + func update(arg: [String], value: T, once: Bool, closure: @escaping (T) -> ()) { updateArgCallCount += 1 if let updateArgHandler = updateArgHandler { return updateArgHandler(arg, value, once, closure) } - } } """ -let overloadMock1 = -""" +let overloadMock1 = """ import AVFoundation import CoreLocation import Foundation class P1Mock: P1 { - - - - init() { - - } + init() { } + var updateCallCount = 0 var updateHandler: (([String], Bool, @escaping () -> ()) -> ())? - func update(arg: [String], once: Bool, closure: @escaping () -> ()) { + func update(arg: [String], once: Bool, closure: @escaping () -> ()) { updateCallCount += 1 if let updateHandler = updateHandler { return updateHandler(arg, once, closure) } - } var updateArgCallCount = 0 var updateArgHandler: (([String], Any, Bool, Any) -> ())? - func update(arg: [String], value: T, once: Bool, closure: @escaping (T) -> ()) { + func update(arg: [String], value: T, once: Bool, closure: @escaping (T) -> ()) { updateArgCallCount += 1 if let updateArgHandler = updateArgHandler { return updateArgHandler(arg, value, once, closure) } - } } """ diff --git a/Tests/TestOverloads/FixtureInheritance.swift b/Tests/TestOverloads/FixtureInheritance.swift index 35e044de..926e7e33 100644 --- a/Tests/TestOverloads/FixtureInheritance.swift +++ b/Tests/TestOverloads/FixtureInheritance.swift @@ -2,8 +2,6 @@ import MockoloFramework // MARK: Simple inheritance let simpleInheritance = """ -import Foundation - /// \(String.mockAnnotation) public protocol SimpleChild: SimpleParent { var name: String { get set } @@ -15,36 +13,32 @@ public protocol SimpleParent: AnyObject { var number: Int { get set } func bar(arg: Double) -> Float? } - """ let simpleInheritanceMock = """ - -import Foundation - public class SimpleChildMock: SimpleChild { - - - - public init() { } + public init() { } public init(name: String = "", number: Int = 0) { self.name = name self.number = number - } + + public private(set) var nameSetCallCount = 0 public var name: String = "" { didSet { nameSetCallCount += 1 } } + public private(set) var fooCallCount = 0 public var fooHandler: (() -> ())? - public func foo() { + public func foo() { fooCallCount += 1 if let fooHandler = fooHandler { fooHandler() } - } + public private(set) var numberSetCallCount = 0 public var number: Int = 0 { didSet { numberSetCallCount += 1 } } + public private(set) var barCallCount = 0 public var barHandler: ((Double) -> Float?)? public func bar(arg: Double) -> Float? { @@ -57,16 +51,15 @@ public class SimpleChildMock: SimpleChild { } public class SimpleParentMock: SimpleParent { - - - - public init() { } + public init() { } public init(number: Int = 0) { self.number = number - } + + public private(set) var numberSetCallCount = 0 public var number: Int = 0 { didSet { numberSetCallCount += 1 } } + public private(set) var barCallCount = 0 public var barHandler: ((Double) -> Float?)? public func bar(arg: Double) -> Float? { @@ -77,7 +70,6 @@ public class SimpleParentMock: SimpleParent { return nil } } - """ // MARK: Composition inheritance @@ -116,7 +108,7 @@ class TestProtocolMock: TestProtocol { private(set) var doSomethingCallCount = 0 var doSomethingHandler: (() -> ())? - func doSomething() { + func doSomething() { doSomethingCallCount += 1 if let doSomethingHandler = doSomethingHandler { doSomethingHandler() @@ -139,7 +131,7 @@ class TestProtocolMock: TestProtocol { private(set) var doSomethingSpecialCallCount = 0 var doSomethingSpecialHandler: (() -> ())? - func doSomethingSpecial() { + func doSomethingSpecial() { doSomethingSpecialCallCount += 1 if let doSomethingSpecialHandler = doSomethingSpecialHandler { doSomethingSpecialHandler() diff --git a/Tests/TestOverrides/FixtureMockNames.swift b/Tests/TestOverrides/FixtureMockNames.swift index f1b6d6d3..32cb7cec 100644 --- a/Tests/TestOverrides/FixtureMockNames.swift +++ b/Tests/TestOverrides/FixtureMockNames.swift @@ -15,7 +15,7 @@ class FooMock: FooProtocol { private(set) var displayCallCount = 0 var displayHandler: (() -> ())? - func display() { + func display() { displayCallCount += 1 if let displayHandler = displayHandler { displayHandler() diff --git a/Tests/TestPATs/FixturePAT.swift b/Tests/TestPATs/FixturePAT.swift index 90bbb151..930c7d03 100644 --- a/Tests/TestPATs/FixturePAT.swift +++ b/Tests/TestPATs/FixturePAT.swift @@ -1,8 +1,6 @@ import MockoloFramework - -let patNameCollision = -""" +let patNameCollision = """ /// \(String.mockAnnotation) protocol Foo { associatedtype T @@ -21,55 +19,28 @@ associatedtype T /// \(String.mockAnnotation) protocol Baz: Foo, Bar, Cat { } - """ -let patNameCollisionMock = -""" - - +let patNameCollisionMock = """ class FooMock: Foo { - - - - init() { - - - } + init() { } typealias T = Any } class BarMock: Bar { - - - - init() { - - - } + init() { } typealias T = String } class CatMock: Cat { - - - - init() { - - - } + init() { } typealias T = Hashable & Codable } class BazMock: Baz { typealias T = Any & Hashable & Codable & String - - init() { - - - } - + init() { } } """ @@ -98,8 +69,7 @@ public class FooBarMock: FooBar { """ -let patOverride = -""" +let patOverride = """ /// \(String.mockAnnotation)(typealias: T = Any; U = Bar; R = (String, Int); S = AnyObject) protocol Foo { associatedtype T @@ -110,10 +80,7 @@ protocol Foo { } """ -let patOverrideMock = -""" - - +let patOverrideMock = """ class FooMock: Foo { init() { } @@ -135,8 +102,7 @@ class FooMock: Foo { """ -let protocolWithTypealias = -""" +let protocolWithTypealias = """ /// \(String.mockAnnotation) public protocol SomeType { typealias Key = String @@ -145,7 +111,6 @@ public protocol SomeType { """ let protocolWithTypealiasMock = """ - public class SomeTypeMock: SomeType { public init() { } public init(key: Key) { @@ -162,8 +127,7 @@ public class SomeTypeMock: SomeType { """ -let patDefaultType = -""" +let patDefaultType = """ /// \(String.mockAnnotation) protocol Foo { associatedtype T @@ -171,24 +135,16 @@ protocol Foo { } """ -let patDefaultTypeMock = -""" +let patDefaultTypeMock = """ class FooMock: Foo { - - - - init() { - - - } + init() { } + typealias T = Any typealias U = Collection where U.Element == T } - """ -let patPartialOverride = -""" +let patPartialOverride = """ /// \(String.mockAnnotation)(typealias: U = AnyObject) protocol Foo { associatedtype T @@ -197,17 +153,9 @@ protocol Foo { """ -let patPartialOverrideMock = - -""" +let patPartialOverrideMock = """ class FooMock: Foo { - - - - init() { - - - } + init() { } typealias T = Any typealias U = AnyObject } diff --git a/Tests/TestRx/FixtureRxVars.swift b/Tests/TestRx/FixtureRxVars.swift index fb7a1b0b..9d28d217 100644 --- a/Tests/TestRx/FixtureRxVars.swift +++ b/Tests/TestRx/FixtureRxVars.swift @@ -173,7 +173,7 @@ public class YMock: Y { } public private(set) var updateCallCount = 0 public var updateHandler: ((SomeKey) -> ())? - public func update(with key: SomeKey) { + public func update(with key: SomeKey) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(key) @@ -241,14 +241,14 @@ public class TasksStreamMock: TasksStream { self.completionTasks = completionTasks } + public private(set) var updateCallCount = 0 public var updateHandler: ((Tasks) -> ())? - public func update(tasks: Tasks) { + public func update(tasks: Tasks) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(tasks) } - } private var tasksSubjectKind = 0 public private(set) var tasksSubjectSetCallCount = 0 @@ -392,6 +392,7 @@ public class BaseTaskScopeListStreamMock: BaseTaskScopeListStream { self.taskScopes = taskScopes } + public private(set) var taskScopesSubjectSetCallCount = 0 var _taskScopes: Observable<[TaskScope]>? { didSet { taskScopesSubjectSetCallCount += 1 } } public var taskScopesSubject = ReplaySubject<[TaskScope]>.create(bufferSize: 1) { didSet { taskScopesSubjectSetCallCount += 1 } } @@ -407,7 +408,8 @@ public class WorkTaskScopeListStreamMock: WorkTaskScopeListStream { self.workTaskScopes = workTaskScopes } - public private(set) var workTaskScopesSubjectSetCallCount = 0 + + public private(set) var workTaskScopesSubjectSetCallCount = 0 var _workTaskScopes: Observable<[TaskScope]>? { didSet { workTaskScopesSubjectSetCallCount += 1 } } public var workTaskScopesSubject = ReplaySubject<[TaskScope]>.create(bufferSize: 1) { didSet { workTaskScopesSubjectSetCallCount += 1 } } public var workTaskScopes: Observable<[TaskScope]> { @@ -421,6 +423,7 @@ public class OnlineStreamMock: OnlineStream { public init(online: Observable = PublishSubject()) { self.online = online } + private var onlineSubjectKind = 0 public private(set) var onlineSubjectSetCallCount = 0 public var onlineSubject = PublishSubject() { didSet { onlineSubjectSetCallCount += 1 } } @@ -462,6 +465,7 @@ public class StateStreamMock: StateStream { public init(state: Observable = PublishSubject()) { self.state = state } + private var stateSubjectKind = 0 public private(set) var stateSubjectSetCallCount = 0 public var stateSubject = PublishSubject() { didSet { stateSubjectSetCallCount += 1 } } @@ -504,6 +508,7 @@ public class WorkStateStreamMock: WorkStateStream { self.isOnJob = isOnJob } + public private(set) var isOnJobSubjectSetCallCount = 0 var _isOnJob: Observable? { didSet { isOnJobSubjectSetCallCount += 1 } } public var isOnJobSubject = BehaviorSubject(value: false) { didSet { isOnJobSubjectSetCallCount += 1 } } @@ -544,7 +549,7 @@ public class TasksStreamMock: TasksStream { } public private(set) var updateCallCount = 0 public var updateHandler: ((Tasks) -> ())? - public func update(tasks: Tasks) { + public func update(tasks: Tasks) { updateCallCount += 1 if let updateHandler = updateHandler { updateHandler(tasks) @@ -675,6 +680,5 @@ public class CompletionTasksStreamMock: CompletionTasksStream { set { if let val = newValue as? BehaviorSubject<[CompletionTask]> { completionTasksSubject = val } else { _completionTasks = newValue } } } } - """ diff --git a/Tests/TestTestableImports/FixtureTestableImportStatements.swift b/Tests/TestTestableImports/FixtureTestableImportStatements.swift index b47cea73..9ac2a33b 100644 --- a/Tests/TestTestableImports/FixtureTestableImportStatements.swift +++ b/Tests/TestTestableImports/FixtureTestableImportStatements.swift @@ -10,27 +10,21 @@ protocol SimpleVar { } """ -let testableImportsMock = -""" - +let testableImportsMock = """ import Foundation @testable import SomeImport1 @testable import SomeImport2 - class SimpleVarMock: SimpleVar { - - - - init() { } + init() { } init(name: Int = 0) { self.name = name - } + + private(set) var nameSetCallCount = 0 var name: Int = 0 { didSet { nameSetCallCount += 1 } } } - """ let testableImportsWithOverlap = """ @@ -44,24 +38,17 @@ protocol SimpleVar { } """ -let testableImportsWithOverlapMock = -""" - +let testableImportsWithOverlapMock = """ import Foundation @testable import SomeImport1 - class SimpleVarMock: SimpleVar { - - - - init() { } + init() { } init(name: Int = 0) { self.name = name - } + private(set) var nameSetCallCount = 0 var name: Int = 0 { didSet { nameSetCallCount += 1 } } } - """ diff --git a/Tests/TestVars/FixtureNonSimpleVars.swift b/Tests/TestVars/FixtureNonSimpleVars.swift index 4298229a..2a7115c1 100644 --- a/Tests/TestVars/FixtureNonSimpleVars.swift +++ b/Tests/TestVars/FixtureNonSimpleVars.swift @@ -47,5 +47,4 @@ public class NonSimpleVarsMock: NonSimpleVars { public static private(set) var someVal2SetCallCount = 0 public static var someVal2: String = "" { didSet { someVal2SetCallCount += 1 } } } - """ diff --git a/Tests/TestVars/FixtureSimpleVars.swift b/Tests/TestVars/FixtureSimpleVars.swift index 895638b2..c85d1442 100644 --- a/Tests/TestVars/FixtureSimpleVars.swift +++ b/Tests/TestVars/FixtureSimpleVars.swift @@ -11,57 +11,44 @@ protocol SimpleVar { """ let simpleVarsMock = """ - import Foundation class SimpleVarMock: SimpleVar { - - - - init() { } + init() { } init(name: Int = 0) { self.name = name - } + private(set) var nameSetCallCount = 0 var name: Int = 0 { didSet { nameSetCallCount += 1 } } } - """ let simpleVarsAllowCallCountMock = """ - import Foundation class SimpleVarMock: SimpleVar { - - init() { } + init() { } init(name: Int = 0) { self.name = name - } + var nameSetCallCount = 0 var name: Int = 0 { didSet { nameSetCallCount += 1 } } } - """ let simpleVarsFinalMock = """ - import Foundation final class SimpleVarMock: SimpleVar { - - - - init() { } + init() { } init(name: Int = 0) { self.name = name - } + private(set) var nameSetCallCount = 0 var name: Int = 0 { didSet { nameSetCallCount += 1 } } } - """