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
Don't panic in serde_test #2435
Conversation
Panics lead to reporting errors in tests inside of serde_test internals, returning errors moves the report location to the corresponding assert_tokens expression
How do test failures look now compared to before? It could be less obvious that the error is a test failure and not a failure from serde. If the errors are indeed misleading, we could also use |
Take the first commit of #2437. Without this change the output is:
Not much helpful. All tests points here: Lines 91 to 99 in f583401
With this change the output is:
Now locations points to the failed test. |
Thanks! While we could have gotten the panic locations fixed by sprinkling track_caller everywhere, the fact that it is a very localized change and gives us the assert_eq message, is very useful imo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [serde](https://serde.rs) ([source](https://github.com/serde-rs/serde)) | dependencies | patch | `1.0.160` -> `1.0.162` | --- ### Release Notes <details> <summary>serde-rs/serde</summary> ### [`v1.0.162`](https://github.com/serde-rs/serde/releases/tag/1.0.162) [Compare Source](serde-rs/serde@v1.0.161...1.0.162) - Support deserializing flattened adjacently tagged enums from data formats which represent fields as bytes, such as the `csv` crate ([#​2377](serde-rs/serde#2377), thanks [@​mfro](https://github.com/mfro)) ```rust #[derive(Deserialize)] pub struct Record { common: u64, #[serde(flatten)] kind: Kind, } #[derive(Deserialize)] #[serde(tag = "kind", content = "parameter", rename_all = "lowercase")] enum Kind { Foo(u64), Bar(bool), } ``` ```csv common,kind,parameter 1,foo,42 2,bar,true ``` ### [`v1.0.161`](https://github.com/serde-rs/serde/releases/tag/v1.0.161) [Compare Source](serde-rs/serde@v1.0.160...v1.0.161) - Improve error messages produced by serde_test on test failure ([#​2435](serde-rs/serde#2435), thanks [@​Mingun](https://github.com/Mingun)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS43Mi4xIiwidXBkYXRlZEluVmVyIjoiMzUuNzIuMSIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AifQ==--> Co-authored-by: cabr2-bot <cabr2.help@gmail.com> Co-authored-by: crapStone <crapstone01@gmail.com> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1891 Reviewed-by: crapStone <crapstone@noreply.codeberg.org> Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org> Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Panics lead to reporting errors in tests inside of serde_test internals, returning errors moves the report location to the corresponding
assert_tokens
expression