I'm probably just holding it wrong but when I try to decode yml values with nil values - which I believe are represented as null | ~ | NULL | Null in yml - I get the corresponding Strings back and not nil:
func test_null_yml() throws {
let s = """
n1: ~
n2: null
n3: NULL
n4: Null
n5:
"""
struct Test: Decodable {
let n1: String?
let n2: String?
let n3: String?
let n4: String?
let n5: String?
}
let t = try YAMLDecoder().decode(Test.self, from: s)
XCTAssertNil(t.n1) // XCTAssertNil failed: "~"
XCTAssertNil(t.n2) // XCTAssertNil failed: "null"
XCTAssertNil(t.n3) // XCTAssertNil failed: "NULL"
XCTAssertNil(t.n4) // XCTAssertNil failed: "Null"
XCTAssertNil(t.n5) // XCTAssertNil failed: ""
}
This is with swift-4.2.1 and Yams
"revision": "26ab35f50ea891e8edefcc9d975db2f6b67e1d68",
"version": "1.0.1"
I see references to all these null tags in
|
XCTAssertEqual(resolver.resolveTag(of: "null"), .str) |
and so I'm wondering: is there something wrong with my test setup above? Or is this perhaps a 🐛?
I'm probably just holding it wrong but when I try to decode yml values with nil values - which I believe are represented as
null | ~ | NULL | Nullin yml - I get the correspondingStrings back and not nil:This is with swift-4.2.1 and Yams
I see references to all these
nulltags inYams/Tests/YamsTests/ResolverTests.swift
Line 16 in c64a5f2