Skip to content
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

Approved file ordering wrong with SortedMaps #196

Closed
JCook21 opened this issue Oct 19, 2021 · 3 comments
Closed

Approved file ordering wrong with SortedMaps #196

JCook21 opened this issue Oct 19, 2021 · 3 comments
Assignees

Comments

@JCook21
Copy link

JCook21 commented Oct 19, 2021

I came across a use case recently where Approvals worked in a way that's different to what I expected. If you're using a sorted map implementation, such as a TreeMap, that sorts keys using something other than natural ordering the output of the approved file is not what is expected. It seems that StringUtils.toString(Map<?, ?> map) sorts maps by their keys by natural ordering. While this behaviour is consistent and the test will pass it's certainly not what you would expect when looking at the file (ask me how long I spent trying to work out why my TreeMap wasn't ordering things as expected before I worked out what was going on... ;) ). Would you consider adding support for sorted maps, maintaining their ordering?

@LarsEckart
Copy link
Contributor

Yes, we'll look into this once we meet again. We're currently on a break though, busy times :)

@LarsEckart LarsEckart self-assigned this Oct 25, 2021
@JCook21
Copy link
Author

JCook21 commented Oct 25, 2021

No worries, let me know if I can help when you do look into this.

@LarsEckart
Copy link
Contributor

released as part of 15.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants