Skip to content
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

partial fix for #298: path.Replace: support anchors #299

Closed
wants to merge 3 commits into from

Conversation

marco-m
Copy link
Contributor

@marco-m marco-m commented Jun 2, 2022

With reference to #298:

Now the path.Replace* functions do not error out any more, but the returned node is
rendered without a newline, thus producing a broken YAML:

expected: "\na: &a-anchor\n  a1: bar\nb: *a-anchor\n".
but got   "\na: &a-anchor   a1: bar\nb: *a-anchor\n"

which rendered with the newlines becomes:

expected:
"
a: &a-anchor
  a1: bar
  b: *a-anchor
"

but got:
"
a: &a-anchor   a1: bar
b: *a-anchor
"

Am I going in the right direction?

Copy link
Owner

@goccy goccy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix test

path_test.go Outdated
@@ -508,6 +508,21 @@ pictures:
author: ken
building:
author: ken
`,
},
// bug with anchor
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the comment.

Now path.Replace* do not error out any more, but the returned node is
rendered without a newline, thus producing a broken YAML:

    expected: "\na: &a-anchor\n  a1: bar\nb: *a-anchor\n".
    but got   "\na: &a-anchor   a1: bar\nb: *a-anchor\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants