Skip to content

Commit aa4bd14

Browse files
Added keyed container encoding tests.
1 parent db4955e commit aa4bd14

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

Sources/ByteArrayCodable/Decoder/SingleValueDecodingContainer.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright Kenneth Laskoski. All Rights Reserved.
22
// SPDX-License-Identifier: MIT
33

4-
import Foundation
5-
64
extension ByteArrayDecoder {
75
final class SingleValueContainer: SingleValueDecodingContainer {
86
private let decoder: ByteArrayDecoder
@@ -57,7 +55,7 @@ extension ByteArrayDecoder {
5755
try T(from: decoder)
5856
}
5957

60-
// MARK: - Protocol implementation
58+
// MARK: - Protocol properties
6159

6260
public var codingPath: [CodingKey]
6361
}

Tests/ByteArrayCodableTests/EncodigTests/KeyedEncodingTest.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ final class KeyedEncodingTest: XCTestCase {
3030

3131
func testStruct() throws {
3232
struct EncodableStruct: Encodable {
33-
let int: Int = 0
33+
let int: Int = 42
3434
let double: Double = .pi
35-
let string: String = "Hello"
35+
let string: String = "你好"
3636
}
3737

3838
XCTAssertEqual(
@@ -42,9 +42,9 @@ final class KeyedEncodingTest: XCTestCase {
4242
0x64,0x6f,0x75,0x62,0x6c,0x65,0,
4343
0x40,0x09,0x21,0xfb,0x54,0x44,0x2d,0x18,
4444
0x69,0x6e,0x74,0,
45-
0,0,0,0,0,0,0,0,
45+
0,0,0,0,0,0,0,0x2a,
4646
0x73,0x74,0x72,0x69,0x6e,0x67,0,
47-
0x48,0x65,0x6c,0x6c,0x6f,0,
47+
0xe4,0xbd,0xa0,0xe5,0xa5,0xbd,0,
4848
]
4949
)
5050
}

0 commit comments

Comments
 (0)