`serde_test2` has been released, reviving the unmaintained `serde_test` crate
โ Rust ๐ 2026-04-07 ๐ค surdeus ๐๏ธ 5The serde_test crate has been unmaintained for over a year now, with the repo being archived at the end of 2024. There were some outstanding issues, so I decided to take it over and release a new version with some much-needed changes. This is a breaking change, so it's version 2.0.0. Most cases should be able to simple replace serde_test = "1.x.y" with serde_test2 = "2.0.0" in Cargo.toml and have everything "just work"โข. So what changed, and what's the breakage?
Tokennow has support forU128andI128.- If you were exhaustively matching on
Tokenfor whatever reason, you'll need to add a fallback arm as it is now marked#[non_exhaustive]. - The variant index is included for unit variants (on enums). This was previously skipped, missing some information that crate authors may find useful.
- The length of map/struct/tuple being validated, some tests may fail. This is by design โ your test was always incorrect! I had to update a couple tests for
timebecause I was expecting five fields when there were actually six present. - Deserialization does not always fall back to
deserialize_any; the concrete deserializer will always be used if called. If this were done before, at least two bugs intimewouldn't have happened! Rather than relying on another dependency to test typed cases, it's now possible to ensure the format is exactly what's intended rather than approximately. #![no_std]support. While not particularly critical for tests, it is nice to be able to run withoutstdenabled.allocis still required unconditionally.- The minimum supported Rust version was bumped from 1.56 to 1.61. This allowed the switch from depending on
serdetoserde_core, which should improve compile times a tiny bit. 1.61 is almost four years old, so I can't imagine this is an issue for anyone. For reference,libchas an MSRV of 1.65.
With the exception of downstream users who were checking unit enum variants and the (presumably rare?) users exhaustively matching on a Token, the breakage from this release should be minimal. When updating time, all I had to do was fix the couple tests that were objectively incorrect as-is; no nontrivial changes were required.
Docs: serde_test2 - Rust
Repo: GitHub - jhpratt/serde_test2: Token De/Serializer for testing De/Serialize implementations ยท GitHub
1 post - 1 participant
๐ท๏ธ Rust_feed