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

Update tests to reflect the different rounding/e-notation when writing numbers between S.T.J and Newtonsoft.Json #32350

Closed
ahsonkhan opened this issue Feb 15, 2020 · 0 comments · Fixed by #35042
Labels
area-System.Text.Json help wanted [up-for-grabs] Good issue for external contributors test-enhancement Improvements of test source code
Milestone

Comments

@ahsonkhan
Copy link
Contributor

Add string comparison asserts for writer tests with various floats/doubles with accurate expected strings. Comparing to the strings from Newtonsoft.Json won't work for all cases, and we should split up those special cases into their own tests with hard-coded strings.

Writing trailing zeros for float/double/decimal number differ. For example:

  • "0" vs "0.0"
  • "message": -1588732675085190 vs. "message": -1588732675085190.0

// TODO: The output doesn't match what JSON.NET does (different rounding/e-notation).
// JsonTestHelper.AssertContents(expectedStr, output);

@ahsonkhan ahsonkhan added area-System.Text.Json test-enhancement Improvements of test source code labels Feb 15, 2020
@ahsonkhan ahsonkhan added this to the 5.0 milestone Feb 15, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Feb 15, 2020
@ahsonkhan ahsonkhan removed the untriaged New issue has not been triaged by the area owner label Feb 15, 2020
@layomia layomia added the help wanted [up-for-grabs] Good issue for external contributors label Apr 7, 2020
@layomia layomia modified the milestones: 5.0.0, Future Jul 7, 2020
marcusturewicz added a commit to marcusturewicz/runtime that referenced this issue Nov 17, 2020
jozkee added a commit that referenced this issue Nov 17, 2020
…#35042)

* Handle unicode and e-notation differences between S.T.J and J.N tests

Fixes #32350

* Remove TODO

* Bumping CI

* Bump CI

* Handle relaxed escaping and precision properly

* Move else if

* Move else if back

* Remove relaxedEscaping param and skip whitespace

* Apply Jozkee final touches

* Add missing period

Co-authored-by: David Cantu <[email protected]>
@ghost ghost locked as resolved and limited conversation to collaborators Dec 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json help wanted [up-for-grabs] Good issue for external contributors test-enhancement Improvements of test source code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants