Skip to content

Commit e28d7f6

Browse files
committed
Merge pull request #27 from robb/swift-1.2
Support Swift 1.2
2 parents c6e5b50 + 7569c59 commit e28d7f6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

LlamaKit/Result.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ extension Result: Printable {
128128
/// Failure coalescing
129129
/// .Success(Box(42)) ?? 0 ==> 42
130130
/// .Failure(NSError()) ?? 0 ==> 0
131-
public func ??<T,E>(result: Result<T,E>, defaultValue: @autoclosure () -> T) -> T {
131+
public func ??<T,E>(result: Result<T,E>, @autoclosure defaultValue: () -> T) -> T {
132132
switch result {
133133
case .Success(let value):
134134
return value.unbox

LlamaKitTests/ResultTests.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ class ResultTests: XCTestCase {
5959

6060
func testMapSuccessNewType() {
6161
let x: Result<String, NSError> = success("abcd")
62-
let y = x.map { countElements($0) }
62+
let y = x.map { count($0) }
6363
XCTAssertEqual(y.value!, 4)
6464
}
6565

6666
func testMapFailureNewType() {
6767
let x: Result<String, NSError> = failure(self.err)
68-
let y = x.map { countElements($0) }
68+
let y = x.map { count($0) }
6969
XCTAssertEqual(y.error!, self.err)
7070
}
7171

@@ -134,8 +134,8 @@ class ResultTests: XCTestCase {
134134
}
135135

136136
func testTryTFailure() {
137-
let result = try(makeTryFunction(nil as Int?, false))
138-
XCTAssertEqual(result ?? 43, 43)
137+
let result = try(makeTryFunction(nil as String?, false))
138+
XCTAssertEqual(result ?? "abc", "abc")
139139
XCTAssert(result.description.hasPrefix("Failure: Error Domain=domain Code=1 "))
140140
}
141141

0 commit comments

Comments
 (0)