Skip to content

Commit

Permalink
fix: Use correct argument order when stringifying flow collection com…
Browse files Browse the repository at this point in the history
…ments (fixes #443)
  • Loading branch information
eemeli committed Feb 20, 2023
1 parent 6765cf5 commit d4460a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/stringify/stringifyCollection.ts
Expand Up @@ -161,7 +161,7 @@ function stringifyFlowCollection(
}

if (comment) {
str += lineComment(str, commentString(comment), indent)
str += lineComment(str, indent, commentString(comment))
if (onComment) onComment()
}
return str
Expand Down
9 changes: 9 additions & 0 deletions tests/doc/comments.ts
Expand Up @@ -554,6 +554,15 @@ describe('stringify comments', () => {
}
`)
})

test('line comment after flow collection (eemeli/yaml#443)', () => {
const doc = YAML.parseDocument(source`
[ value1, value2 ] # comment
`)
expect(String(doc)).toBe(source`
[ value1, value2 ] # comment
`)
})
})
})

Expand Down

0 comments on commit d4460a5

Please sign in to comment.