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

Add test for field ordering #1042

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

levinson
Copy link

Pull Request Checklist

  • Have you read through the contributor guidelines?
  • Have you squashed your commits?
  • Have you added copyright headers to new files? N/A
  • Have you updated the documentation? N/A
  • Have you added tests for any changed functionality? N/A

Purpose

This PR demonstrates #1038. The new test fails due to serialized field order when compiled with Scala 3:

[info] - should preserve field ordering *** FAILED *** (33 milliseconds)
[info]   "{"[a":42,"m1":"foo","b":"baz","c":"bar","z":1.2]}" did not equal "{"[m1":"foo","c":"bar","z":1.2,"a":42,"b":"baz"]}" (JsonSharedSpec.scala:454)

"preserve field ordering" in {
val model = Model(Some("foo"), "bar", Some(1.2), 42, Some("baz"))
val serialized = Json.stringify(Json.toJson(model))
serialized.mustEqual("""{"m1":"foo","c":"bar","z":1.2,"a":42,"b":"baz"}""")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
serialized.mustEqual("""{"m1":"foo","c":"bar","z":1.2,"a":42,"b":"baz"}""")
serialized.mustEqual("""{"m1":"foo","c":"bar","z":1.2,"a":42,"b":"baz"}""")

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

Successfully merging this pull request may close these issues.

None yet

2 participants