Fix String decoding

This commit is contained in:
Damiaan Dufaux 2017-08-03 11:59:10 +02:00
parent b6fbe7b393
commit c92a7028eb
3 changed files with 4 additions and 2 deletions

View file

@ -146,7 +146,8 @@ struct MsgPckSingleValueDecodingContainer: SingleValueDecodingContainer {
return .init(bitPattern: bitPattern)
}
mutating func decode(_ type: String.Type) throws -> String {
func decode(_ type: String.Type) throws -> String {
var base = self.base
return try Format.string(from: &decoder.storage, base: &base)
}

View file

@ -121,7 +121,7 @@ class MsgPackTests: XCTestCase {
func testExample() {
do {
print("roundtrip:", try roundtrip(value: Simple(a: false, b: false)))
print("roundtrip:", try roundtrip(value: "Simple 🎁"))
} catch {
print(error)
}

View file

@ -50,4 +50,5 @@ struct Simple: Codable {
}
try roundtrip(value: -56.4)
try roundtrip(value: "Hello world 😎")
try roundtrip(value: Simple(a: true, b: false, c: true, d: false, e: nil))