-
Notifications
You must be signed in to change notification settings - Fork 115
Fix Issues #20, #40, and #45 by using the same escaping as Protobuf d… #48
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
Conversation
…ping as Protobuf distribution The Unicode escaping that the Protocol Buffer distribution supports is not implemented for now. Add tests.
-- so you can't use Prelude.read to parse the strings created here. | ||
pprintByteString :: String -> Data.ByteString.ByteString -> Doc | ||
pprintByteString name x = text name <> colon <+> char '\"' | ||
<> text (concatMap escape $ Data.ByteString.unpack x) <> char '\"' |
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.
Include the other ascii escapes like '\a', '\b', etc. in our TextFormat output?
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.
I followed the distribution, see https://github.com/google/protobuf/blob/master/src/google/protobuf/stubs/strutil.cc#L578, in not emitting those.
This inspired me to add a test for parsing them, though.
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.
Overall looks good!
…ens into distribution-escaping
See the contents of escapeMessage and escapeRendered. -m On Wed, Sep 14, 2016 at 9:34 PM, Judah Jacobson [email protected]
|
Also split out text_format_test's .proto file rather than sharing it with canonical_test. Note: PR google#48 previously referenced this bug, but it looks like that was a typo since that fix was for string escaping, not field ordering.
Also split out text_format_test's .proto file rather than sharing it with canonical_test. Also changed the "field name" stored in Data.ProtoLens.Message.FieldDescriptor to be the name of that type, which is more consistent with how TextFormat prints/parses such messages. Note: PR google#48 previously referenced this bug, but it looks like that was a typo since that fix was for string escaping, not field ordering.
Also split out text_format_test's .proto file rather than sharing it with canonical_test. Also changed the "field name" stored in Data.ProtoLens.Message.FieldDescriptor to be the name of that type, which is more consistent with how TextFormat prints/parses such messages. This change simplifies the new code. Note: PR google#48 previously referenced this bug, but it looks like that was a typo since that fix was for string escaping, not field ordering.
Also split out text_format_test's .proto file rather than sharing it with canonical_test. Also changed the "field name" stored in Data.ProtoLens.Message.FieldDescriptor to be the name of that type, which is more consistent with how TextFormat prints/parses such messages. This change simplifies the new code. Note: PR #48 previously referenced this bug, but it looks like that was a typo since that fix was for string escaping, not field ordering.
Also split out text_format_test's .proto file rather than sharing it with canonical_test. Also changed the "field name" stored in Data.ProtoLens.Message.FieldDescriptor to be the name of that type, which is more consistent with how TextFormat prints/parses such messages. This change simplifies the new code. Note: PR google#48 previously referenced this bug, but it looks like that was a typo since that fix was for string escaping, not field ordering.
Also split out text_format_test's .proto file rather than sharing it with canonical_test. Also changed the "field name" stored in Data.ProtoLens.Message.FieldDescriptor to be the name of that type, which is more consistent with how TextFormat prints/parses such messages. This change simplifies the new code. Note: PR google#48 previously referenced this bug, but it looks like that was a typo since that fix was for string escaping, not field ordering.
…istribution
The Unicode escaping that the Protocol Buffer distribution supports is
not implemented for now.
Add tests.