From 5054817cc51ec242e8cb46779169cff8818c8904 Mon Sep 17 00:00:00 2001 From: Yuta Koshizawa Date: Wed, 18 Oct 2017 17:56:55 +0900 Subject: [PATCH] Update `description` for unfulfilled `Promise` --- Sources/PromiseK/Promise.swift | 2 +- Tests/PromiseKTests/PromiseKTests.swift | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/PromiseK/Promise.swift b/Sources/PromiseK/Promise.swift index aceda50..28235b4 100644 --- a/Sources/PromiseK/Promise.swift +++ b/Sources/PromiseK/Promise.swift @@ -53,7 +53,7 @@ extension Promise : CustomStringConvertible { if let value = self.value { return "Promise(\(value))" } else { - return "Promise" + return "Promise(\(Value.self))" } } } diff --git a/Tests/PromiseKTests/PromiseKTests.swift b/Tests/PromiseKTests/PromiseKTests.swift index d220244..3b98c40 100644 --- a/Tests/PromiseKTests/PromiseKTests.swift +++ b/Tests/PromiseKTests/PromiseKTests.swift @@ -49,6 +49,11 @@ class PromiseKTests: XCTestCase { XCTAssertEqual(obtained, .some(42)) } + func testDescription() { + XCTAssertEqual(Promise(42).description, "Promise(42)") + XCTAssertEqual(Promise { _ in }.description, "Promise(Int)") + } + func testFailableMap() { do { let squared = asyncGetOrFail(3, false).map {