Skip to content

Commit

Permalink
Merge pull request #53 from raptorxcz/bugfix/spies
Browse files Browse the repository at this point in the history
Fix throwing closures
  • Loading branch information
raptorxcz authored Sep 21, 2023
2 parents e59ae8c + c66accd commit f221d9d
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Application/RubiconApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
"DEVELOPMENT_TEAM[sdk=macosx*]" = 473264X5JK;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = RubiconExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = RubiconExtension;
INFOPLIST_KEY_CFBundleDisplayName = Rubicon;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -350,7 +350,7 @@
"DEVELOPMENT_TEAM[sdk=macosx*]" = 473264X5JK;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = RubiconExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = RubiconExtension;
INFOPLIST_KEY_CFBundleDisplayName = Rubicon;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down
2 changes: 1 addition & 1 deletion Sources/Rubicon/Generator/SpyGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ final class SpyGenerator {
var variables = [VarDeclaration]()

if declaration.isThrowing {
let throwBlockType = TypeDeclaration(name: "(() -> Void)?", isOptional: true, prefix: [.escaping])
let throwBlockType = TypeDeclaration(name: "(() throws -> Void)?", isOptional: true, prefix: [.escaping])
variables.append(VarDeclaration(isConstant: false, identifier: name + "ThrowBlock", type: throwBlockType))
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Rubicon/Generator/StubGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ final class StubGenerator {
var variables = [VarDeclaration]()

if declaration.isThrowing {
let throwBlockType = TypeDeclaration(name: "(() -> Void)?", isOptional: true, prefix: [.escaping])
let throwBlockType = TypeDeclaration(name: "(() throws -> Void)?", isOptional: true, prefix: [.escaping])
variables.append(VarDeclaration(isConstant: false, identifier: name + "ThrowBlock", type: throwBlockType))
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/RubiconTests/Generator/SpyGeneratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ final class SpyGeneratorTests: XCTestCase {

XCTAssertEqual(variableGeneratorSpy.makeCode.count, 2)
XCTAssertEqual(variableGeneratorSpy.makeCode.first?.declaration.identifier, "functionNameThrowBlock")
XCTAssertEqual(variableGeneratorSpy.makeCode.first?.declaration.type, .makeStub(name: "(() -> Void)?", isOptional: true, prefix: [.escaping]))
XCTAssertEqual(variableGeneratorSpy.makeCode.first?.declaration.type, .makeStub(name: "(() throws -> Void)?", isOptional: true, prefix: [.escaping]))
XCTAssertEqual(variableGeneratorSpy.makeCode.first?.declaration.isConstant, false)
XCTAssertEqual(variableGeneratorSpy.makeCode.last?.declaration.identifier, "functionNameReturn")
XCTAssertEqual(variableGeneratorSpy.makeCode.last?.declaration.type, returnType)
Expand Down
2 changes: 1 addition & 1 deletion Tests/RubiconTests/Generator/StubGeneratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ final class StubGeneratorTests: XCTestCase {

XCTAssertEqual(variableGeneratorSpy.makeCode.count, 2)
XCTAssertEqual(variableGeneratorSpy.makeCode.first?.declaration.identifier, "functionNameThrowBlock")
XCTAssertEqual(variableGeneratorSpy.makeCode.first?.declaration.type, .makeStub(name: "(() -> Void)?", isOptional: true, prefix: [.escaping]))
XCTAssertEqual(variableGeneratorSpy.makeCode.first?.declaration.type, .makeStub(name: "(() throws -> Void)?", isOptional: true, prefix: [.escaping]))
XCTAssertEqual(variableGeneratorSpy.makeCode.first?.declaration.isConstant, false)
XCTAssertEqual(variableGeneratorSpy.makeCode.last?.declaration.identifier, "functionNameReturn")
XCTAssertEqual(variableGeneratorSpy.makeCode.last?.declaration.type, returnType)
Expand Down
4 changes: 2 additions & 2 deletions Tests/RubiconTests/Integration/SpyIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ final class SpyIntegrationTests: XCTestCase {
"-var name: String?",
"-var color: Int",
"",
"-var loadThrowBlock: (() -> Void)?",
"-var loadThrowBlock: (() throws -> Void)?",
"-var loadReturn: Int",
"-var isFullReturn: Bool",
"-var downloadThrowBlock: (() -> Void)?",
"-var downloadThrowBlock: (() throws -> Void)?",
"-var downloadReturn: [String]",
"-var goCount = 0",
"-var load = [Load]()",
Expand Down
4 changes: 2 additions & 2 deletions Tests/RubiconTests/Integration/StubIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ final class StubIntegrationTests: XCTestCase {
"final class CarStub: Car {",
"-var name: String?",
"-var color: Int",
"-var loadThrowBlock: (() -> Void)?",
"-var loadThrowBlock: (() throws -> Void)?",
"-var loadReturn: Int",
"-var isFullReturn: Bool",
"-var downloadThrowBlock: (() -> Void)?",
"-var downloadThrowBlock: (() throws -> Void)?",
"-var downloadReturn: [String]",
"",
"-init(color: Int, loadReturn: Int, isFullReturn: Bool, downloadReturn: [String]) {",
Expand Down

0 comments on commit f221d9d

Please sign in to comment.