Is it possible to copy output from the assertion left == right failed of a test and paste it as the correct test result?
I'm working on a library that produces large structs and this would make writing tests much easier.
Of course I can copy/paste the output from the terminal but the problem is that every struct/enum has just a name (Foo) instead of a relative/full path (bar::Foo) and some names even collide.
I also tried pretty_assertions::assert_eq as the testing output but it also shows names only, not relative/full paths.
In general, there is no way to print a data structure except the ways its type provides you with traits.
The output of assert_eq! and friends is std::fmt::Debug output. There is no way to ask it to print full paths, and in the general case it isn't reliably Rust syntax at all.
The thing that you are asking for is in a sense more like serialization, and so if you used #[derive(serde::Serialize)] together with uneval you could get syntactically well-formed Rust code out of a wider variety of cases, but that doesn't produce full paths either (because serde doesn't collect them in its derive macro).
So, in order to solve this problem completely, you would need to define a new trait and derive macro and apply it to all the involved types. I imagine you probably don't want to go that far.
I'll normally reach for snapshot tests in situations like this where you have large test outputs. That way you side-step needing to copy/paste the actual value entirely because you're checking against some sort of serialised value, and the snapshot library will give you tools to update your expected value automatically.
If you do decide to do testing of Debug output, note that Debug output is not guaranteed to be stable. This means that your test suite might be broken by future Rust versions, and require updating.