-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Newline string literals produce invalid marshaling output #1004
Comments
Alfus
added a commit
to bufbuild/protoyaml-go
that referenced
this issue
Nov 18, 2023
And disable "\n" string tests for now (see go-yaml/yaml#1004) Previously, negative durations with nanos were producing invalid values, which wasn't caught because the round trip tests didn't actually check the results of the diff :-(.
Here is a variation related to serialization of func TestNewLine(t *testing.T) {
const orig = "\n"
data, err := yaml.Marshal("\n")
if err != nil {
t.Fatal(err)
}
var s string
err = yaml.Unmarshal(data, &s)
if err != nil {
t.Fatal(err)
}
if s != orig {
t.Fatalf("got %q, expected %q", s, orig)
}
}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If keys or values of a map node are the string literal "\n", the encoder has odd output.
The output is:
Which doesn't appear to be valid yaml. When it should be:
The text was updated successfully, but these errors were encountered: