diff --git a/Codec/Tests/CodecTests/DecoderTests.swift b/Codec/Tests/CodecTests/DecoderTests.swift index 75570e69..277ca2ab 100644 --- a/Codec/Tests/CodecTests/DecoderTests.swift +++ b/Codec/Tests/CodecTests/DecoderTests.swift @@ -79,6 +79,9 @@ struct DecoderTests { #expect(throws: DecodingError.self) { _ = try JamDecoder.decode([String: [Int]].self, from: corruptedEncodedData) } + #expect(throws: DecodingError.self) { + _ = try JamDecoder.decode([String: [Int]]?.self, from: corruptedEncodedData) + } } @Test func decodeEmptyDataForArray() throws { diff --git a/Codec/Tests/CodecTests/IntegerCodecTests.swift b/Codec/Tests/CodecTests/IntegerCodecTests.swift index c8cef7d8..69836b82 100644 --- a/Codec/Tests/CodecTests/IntegerCodecTests.swift +++ b/Codec/Tests/CodecTests/IntegerCodecTests.swift @@ -113,5 +113,8 @@ import Testing #expect(data.decode() == nil) #expect(data.decode(length: 20) as UInt64? == nil) #expect(data.decode(length: -1) as UInt64? == nil) + var emptyBytes: [UInt8] = [] + let result = IntegerCodec.decode { emptyBytes.popLast() } + #expect(result == nil) } }