-
Notifications
You must be signed in to change notification settings - Fork 334
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
json.pretty_generate behaviour changed in 2.8.0 #714
Comments
Yes this change was fully intended I just forgot to include it in the changelog, sorry. I don't really want to add an option for it as the new output is much more readable and there's already a tons of conditionals that hurt performance on this codepath. Why is this change a problem for you? |
thats okay sometimes things slip through the net. its changed the output of our diffs for a project - see description in the following PR, which for us anyway isn’t correct. |
Seems like you have a good workaround to make your test suite work with both versions. |
thanks, I wasn’t sure if it was the right approach ( the workaround) or to raise an issue. cheers for clarifying, will proceed with my PR now |
Depends what you are trying to assert exactly. If the exact formatting doesn't matter, you can also compare |
Issue: Empty hashes no longer print over two lines in json 2.8.0 when using
JSON.pretty_generate
Expected: Empty hashes would print over two lines in json 2.8.0
Actual: Empty hashes would print on a single line in json 2.8.0
Observations: Only occurs in Ruby 3.0.x +, works correctly in 2.7
Reproducer
Change the gem version, and run script
Output
With Ruby 3.x
2.7.6
2.8.0
The text was updated successfully, but these errors were encountered: