Skip to content

Commit

Permalink
Added keyed container encoding tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethlaskoski committed Jun 16, 2022
1 parent db4955e commit aa4bd14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright Kenneth Laskoski. All Rights Reserved.
// SPDX-License-Identifier: MIT

import Foundation

extension ByteArrayDecoder {
final class SingleValueContainer: SingleValueDecodingContainer {
private let decoder: ByteArrayDecoder
Expand Down Expand Up @@ -57,7 +55,7 @@ extension ByteArrayDecoder {
try T(from: decoder)
}

// MARK: - Protocol implementation
// MARK: - Protocol properties

public var codingPath: [CodingKey]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ final class KeyedEncodingTest: XCTestCase {

func testStruct() throws {
struct EncodableStruct: Encodable {
let int: Int = 0
let int: Int = 42
let double: Double = .pi
let string: String = "Hello"
let string: String = "你好"
}

XCTAssertEqual(
Expand All @@ -42,9 +42,9 @@ final class KeyedEncodingTest: XCTestCase {
0x64,0x6f,0x75,0x62,0x6c,0x65,0,
0x40,0x09,0x21,0xfb,0x54,0x44,0x2d,0x18,
0x69,0x6e,0x74,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0x2a,
0x73,0x74,0x72,0x69,0x6e,0x67,0,
0x48,0x65,0x6c,0x6c,0x6f,0,
0xe4,0xbd,0xa0,0xe5,0xa5,0xbd,0,
]
)
}
Expand Down

0 comments on commit aa4bd14

Please sign in to comment.