-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made sure node encoding strategy is considered for values inside unkeyed containers #2
Made sure node encoding strategy is considered for values inside unkeyed containers #2
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2 +/- ##
===========================================
+ Coverage 11.82% 24.58% +12.75%
===========================================
Files 12 12
Lines 1547 1554 +7
===========================================
+ Hits 183 382 +199
+ Misses 1364 1172 -192
Continue to review full report at Codecov.
|
Thank you @regexident, I'm pretty sure that codecov will pass after I merge #1 that gives us correct test coverage. In general I think that the library shouldn't use |
Thanks for the quick update @regexident, would you mind also adding a separate test case with inline XML similar to what is done here? Looks like you already have test XML and Swift code that reproduce this. This new test should probably be added in a new separate file, as |
I actually did try adding test cases for this, alas As such I'm somewhat unsure how to test this properly, other than e.g. doing |
Wouldn't it be possible to test this with a single node? I hope the bug is still reproducible in that case. I guess we would always get the same result for a single node even with random ordering. So we only need to test that we don't get this result
instead of the correct one
|
That should work, yes. For what it's worth I'm currently hacking on a refactor that would enable order-preservation, as XML often times expects elements to appear in a certain order. This should then also make testing much easier. |
great stuff, thanks again! |
Narrator: "It did." |
This fixes a bug that would make
XMLEncoder
ignore the node-encoding strategy for values contained in unkeyed collections.Given a set of types like this …
… and an encoder configured like this …
… produces output that looks like this …
… while the correct output would look like this …