-
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
added a flag to indent or not indent the sequence #750
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.vscode | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -656,6 +656,18 @@ func (s *S) TestSetIndent(c *C) { | |
c.Assert(buf.String(), Equals, "a:\n b:\n c: d\n") | ||
} | ||
|
||
// This test is providing coverage for SetIndentSequences function. | ||
// When we are setting that to false the sequences are not indented. | ||
func (s *S) TestSetIndentSequences(c *C) { | ||
var buf bytes.Buffer | ||
enc := yaml.NewEncoder(&buf) | ||
enc.SetIndentSequences(false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should there be a test for setting it to true? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it's actually true (well the inverse under the hood) by default so the above tests for sequences cover it. We can add an explicit set to true and make sure it works. It's not a bad idea. |
||
|
||
err := enc.Encode(map[string][]string{"a": {"b", "c"}}) | ||
c.Assert(err, Equals, nil) | ||
c.Assert(buf.String(), Equals, "a:\n- b\n- c\n") | ||
} | ||
|
||
func (s *S) TestSortedOutput(c *C) { | ||
order := []interface{}{ | ||
false, | ||
|
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.
why add this?
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.
VS Code is a popular editor. I was surprised that there was not a gitignore for this.