Replies: 1 comment 1 reply
-
I think I'm seeing the advantage of this now. So is the case of this library - it's not clear whether the snapshot was for ATM only three consecutive lines are "special". The reason I used |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think it's important for plaintext snapshots to have perfect roundtrips. That means that it's okay if the encoded text isn't exactly the same as the original text, but when decoded it should be exactly the same again, including newlines. I can see a good argument for removing all
\r
from snapshots though...Dumb example: if you change every character into open paren unicode number hex close parent so that
A
becomes(41)
, that encoding is bad, but lossless. You get back exactly what you put in.By picking rare characters for the brackets and escape characters, you get an encoding which is almost always just the text on its own, but in the rare case that you need to escape some characters to encode, you can still perfectly decode.
I dumped some example code which does encoding of that type into #126, feel free to use it if you'd like.
Beta Was this translation helpful? Give feedback.
All reactions