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

Fix throwing closures #53

Merged
merged 1 commit into from
Sep 21, 2023
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 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
Loading