jonasbb / serde_with

This crate provides custom de/serialization helpers to use in combination with serde's `with`-annotation and with the improved `serde_as`-annotation.
https://docs.rs/serde_with
Apache License 2.0
636 stars 67 forks source link

Fix tests with serde >= 1.0.196 #740

Closed jamessan closed 4 months ago

jamessan commented 4 months ago

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.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jonasbb commented 4 months ago

Thanks for the contribution.