Always encode empty elements as KeyedBox#101
Conversation
Codecov Report
@@ Coverage Diff @@
## master #101 +/- ##
=========================================
+ Coverage 75.82% 77.72% +1.9%
=========================================
Files 38 37 -1
Lines 2039 2088 +49
=========================================
+ Hits 1546 1623 +77
+ Misses 493 465 -28
Continue to review full report at Codecov.
|
|
@MaxDesiatov a quick question, is 237cc28 required for this to work? I'm getting a bunch of non-trivial conflicts when trying to merge it: also, it doesn't seem to be working without it, at least for me. |
`UnkeyedBox` is a wrapper for `[Box]`, the assumption is that adding direct `Box` conformance to `[Box]` would simplify things a bit. Also, `KeyedStorage` now always stores `[Box]` per key without any special handling for single items per key to simplify this even more. In addition, order of values is preserved for all keys as required for #91 and #25. This should also unblock #101 providing unified handling for elements without any content and attributes. By pure serendipity this also fixes tests introduced in #38. * Replace UnkeyedBox with Array, refine KeyedStorage * Fix more of the broken tests * One unfixed test left in benchmarks * Single out failing benchmark in a separate test * Fix all tests 🎉 * Fix compiler warning * Fix Xcode 10.1 compilation error * Remove unused AnyArray protocol * Remove unused elementType function * Simplify code to improve test coverage
…ullbox # Conflicts: # Sources/XMLCoder/Auxiliaries/KeyedStorage.swift # Sources/XMLCoder/Decoder/XMLDecoderImplementation.swift # Sources/XMLCoder/Decoder/XMLKeyedDecodingContainer.swift # Sources/XMLCoder/Encoder/XMLKeyedEncodingContainer.swift # Tests/XMLCoderTests/Box/KeyedBoxTests.swift # Tests/XMLCoderTests/Box/UnkeyedBoxTests.swift # XMLCoder.xcodeproj/project.pbxproj
|
As was highlighted in #103 a nice workaround is to make the array element optional. While this PR increases test coverage by deleting |
`UnkeyedBox` is a wrapper for `[Box]`, the assumption is that adding direct `Box` conformance to `[Box]` would simplify things a bit. Also, `KeyedStorage` now always stores `[Box]` per key without any special handling for single items per key to simplify this even more. In addition, order of values is preserved for all keys as required for CoreOffice#91 and CoreOffice#25. This should also unblock CoreOffice#101 providing unified handling for elements without any content and attributes. By pure serendipity this also fixes tests introduced in CoreOffice#38. * Replace UnkeyedBox with Array, refine KeyedStorage * Fix more of the broken tests * One unfixed test left in benchmarks * Single out failing benchmark in a separate test * Fix all tests 🎉 * Fix compiler warning * Fix Xcode 10.1 compilation error * Remove unused AnyArray protocol * Remove unused elementType function * Simplify code to improve test coverage

This fixes decoding of empty elements in certain cases that weren't previously covered, specifically CoreOffice/CoreXLSX#64.