From cf42893efe4987190d935d2ef2317b5cc04e135e Mon Sep 17 00:00:00 2001 From: dscyrescotti Date: Sat, 13 Feb 2021 15:22:20 +0630 Subject: [PATCH] test: finish defaultable tests --- Tests/CodableXTests/DefaultableTests.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tests/CodableXTests/DefaultableTests.swift b/Tests/CodableXTests/DefaultableTests.swift index 5ef6ad0..54ba879 100644 --- a/Tests/CodableXTests/DefaultableTests.swift +++ b/Tests/CodableXTests/DefaultableTests.swift @@ -8,12 +8,14 @@ final class DefaultableTests: XCTestCase { XCTAssertEqual(value.string, "") XCTAssertEqual(value.double, 0.0) XCTAssertEqual(value.int, 0) + XCTAssertEqual(value.dict, [:]) encode(value) { (v, data) in let decoded = decode(DefaultableTest.self, data) XCTAssertEqual(value.bool, decoded.bool) XCTAssertEqual(value.string, decoded.string) XCTAssertEqual(value.double, decoded.double) XCTAssertEqual(value.int, decoded.int) + XCTAssertEqual(value.dict, decoded.dict) } } } @@ -24,7 +26,7 @@ struct DefaultableTest: AnyCodable { @Defaultable var string: String @Defaultable var double: Double @Defaultable var bool: Bool - @Defaultable var dict: [String: DefaultableTest] + @Defaultable var dict: [String: Bool] } -fileprivate let str = #"{}"# +fileprivate let str = #"{"dict":null}"#