-
-
Notifications
You must be signed in to change notification settings - Fork 140
Description
What happened?
#713 changes the behaviour of assert_snapshot so that whenever there are control characters in the string, it gets printed using format! which will instead of literally.
When the string contains just \n and \t, this makes the diff less readable:
insta::assert_snapshot!(stdout, @"immutable_bookmark\timmutable\nmutable_bookmark\tmutable\nk\tworking_copy\ny\tmutable\nq\timmutable\nzq\tremote_commit\nzz\t(no description set)\nremote_bookmark@origin\tremote_commit\nalias_with_newline\t roots(\nsiblings\t@-+ ~@");This could be fixed by treating \t as \n in has_control_chars:
https://github.com/mitsuhiko/insta/pull/713/files#diff-2666420e8389f1d842ce108018b05f3f68fa4b920f8c1793a3d4d01f21443544R696-R698
Personally I would go even further and prefer the old handling for \x1b (used for ANSI escape codes) as well.
Here's the diff for applying insta 1.42.1 on jj jakobhellermann/jj@7fdb978 and in my opinion it is much less readable.
Reproduction steps
No response
Insta Version
1.42.1
rustc Version
rustc 1.85.0-nightly (45d11e51b 2025-01-01)
What did you expect?
No response

