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

Fix tests with serde >= 1.0.196 #740

Merged
merged 1 commit into from May 3, 2024
Merged

Conversation

jamessan
Copy link
Contributor

@jamessan jamessan commented May 2, 2024

In serde 1.0.196, the "invalid type" error message for floats started
adding a trailing ".0" if no decimal point was already part of the
formatted float, causing tests to fail like:

---- test_chrono_timestamp_seconds_with_frac stdout ----

error: expect test failed
   --> serde_with/tests/chrono_0_4.rs:551:9

Expect:
----
invalid type: floating point `0`, expected a string at line 1 column 3
----

Actual:
----
invalid type: floating point `0.0`, expected a string at line 1 column 3
----

Change the tests to use a test value of 0.1, so the test will work both
pre- and post-serde 1.0.196.

In serde 1.0.196, the "invalid type" error message for floats started
adding a trailing ".0" if no decimal point was already part of the
formatted float, causing tests to fail like:

    ---- test_chrono_timestamp_seconds_with_frac stdout ----

    error: expect test failed
       --> serde_with/tests/chrono_0_4.rs:551:9

    Expect:
    ----
    invalid type: floating point `0`, expected a string at line 1 column 3
    ----

    Actual:
    ----
    invalid type: floating point `0.0`, expected a string at line 1 column 3
    ----

Change the tests to use a test value of 0.1, so the test will work both
pre- and post-serde 1.0.196.
Copy link

codecov bot commented May 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.55%. Comparing base (04de4ce) to head (1e4481c).
Report is 17 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #740   +/-   ##
=======================================
  Coverage   66.55%   66.55%           
=======================================
  Files          38       38           
  Lines        2473     2473           
=======================================
  Hits         1646     1646           
  Misses        827      827           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jonasbb
Copy link
Owner

jonasbb commented May 3, 2024

Thanks for the contribution.

@jonasbb jonasbb merged commit 3f066d7 into jonasbb:master May 3, 2024
22 checks passed
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