You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this playground explains the problem. When we .serialize() a Vec of objects that implements Serialize with the Serializer of the csv crate, it doesn't create a line for each object but flatten them together. There might be good reasons to do it in csv but it does make assert_csv_snapshot!() not really useful. I hope I did not miss an obvious solution to what I'm trying to do. And also, I was not sure to report this as a bug or as a feature so please forgive me if that's not the right category.
Additional helpful information:
Version of insta: 1.5.2
Version of rustc: 1.49.0
Operating system and version: Linux Ubuntu 20.10
What did you expect
I would expect to be able to send a Vec or any kind of iterator of objects implementing Serialize, to the macro assert_csv_snapshot!() and be able to have a multiline *.snap instead of a 2-lines (one header line + one content line).
The text was updated successfully, but these errors were encountered:
Yep. I also ran into this and I think the current format is not particularly useful. Would accept a PR to modify this behavior but currently relatively low priority for myself to fix this.
Description
I believe this playground explains the problem. When we
.serialize()
aVec
of objects that implementsSerialize
with theSerializer
of thecsv
crate, it doesn't create a line for each object but flatten them together. There might be good reasons to do it incsv
but it does makeassert_csv_snapshot!()
not really useful. I hope I did not miss an obvious solution to what I'm trying to do. And also, I was not sure to report this as a bug or as a feature so please forgive me if that's not the right category.Additional helpful information:
What did you expect
I would expect to be able to send a
Vec
or any kind of iterator of objects implementingSerialize
, to the macroassert_csv_snapshot!()
and be able to have a multiline*.snap
instead of a 2-lines (one header line + one content line).The text was updated successfully, but these errors were encountered: