mirror of
https://github.com/caoer/CodableFirebase.git
synced 2026-04-01 22:35:55 +08:00
cover top level nullable types
This commit is contained in:
@@ -397,6 +397,17 @@ class TestCodableFirestore: XCTestCase {
|
||||
_testRoundTrip(of: Employee.testValue)
|
||||
}
|
||||
|
||||
func testEncodingTopLevelNullableType() {
|
||||
// EnhancedBool is a type which encodes either as a Bool or as nil.
|
||||
_testEncodeFailure(of: EnhancedBool.true)
|
||||
_testEncodeFailure(of: EnhancedBool.false)
|
||||
_testEncodeFailure(of: EnhancedBool.fileNotFound)
|
||||
|
||||
_testRoundTrip(of: TopLevelWrapper(EnhancedBool.true))
|
||||
_testRoundTrip(of: TopLevelWrapper(EnhancedBool.false))
|
||||
_testRoundTrip(of: TopLevelWrapper(EnhancedBool.fileNotFound))
|
||||
}
|
||||
|
||||
func testTypeCoercion() {
|
||||
_testRoundTripTypeCoercionFailure(of: [false, true], as: [Int].self)
|
||||
_testRoundTripTypeCoercionFailure(of: [false, true], as: [Int8].self)
|
||||
|
||||
Reference in New Issue
Block a user