mirror of
https://github.com/Dev1an/MsgPack.git
synced 2026-03-25 08:45:55 +00:00
Fix String decoding
This commit is contained in:
parent
b6fbe7b393
commit
c92a7028eb
3 changed files with 4 additions and 2 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue