Skip to content

Commit

Permalink
Added testcase to show bug
Browse files Browse the repository at this point in the history
  • Loading branch information
doxsch authored Mar 16, 2021
1 parent 0e5c090 commit d3297ac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ var writeCommentTests = []struct {
{"# comment\n\nkey = value", "# comment\nkey = value\n", "ISO-8859-1"},
{"# comment1\n# comment2\nkey = value", "# comment1\n# comment2\nkey = value\n", "ISO-8859-1"},
{"#comment1\nkey1 = value1\n#comment2\nkey2 = value2", "# comment1\nkey1 = value1\n\n# comment2\nkey2 = value2\n", "ISO-8859-1"},
// prevent double encoding \\ -> \\\\ -> \\\\\\\\
{"# com\\\\ment\nkey = value", "# com\\\\ment\nkey = value\n", "ISO-8859-1"},


// UTF-8 tests
{"key = value", "key = value\n", "UTF-8"},
Expand All @@ -185,6 +188,8 @@ var writeCommentTests = []struct {
{"# comment⌘\n\nkey = value⌘", "# comment⌘\nkey = value⌘\n", "UTF-8"},
{"# comment1⌘\n# comment2⌘\nkey = value⌘", "# comment1⌘\n# comment2⌘\nkey = value⌘\n", "UTF-8"},
{"#comment1⌘\nkey1 = value1⌘\n#comment2⌘\nkey2 = value2⌘", "# comment1⌘\nkey1 = value1⌘\n\n# comment2⌘\nkey2 = value2⌘\n", "UTF-8"},
// prevent double encoding \\ -> \\\\ -> \\\\\\\\
{"# com\\\\ment⌘\nkey = value⌘", "# com\\\\ment⌘\nkey = value⌘\n", "UTF-8"},
}

// ----------------------------------------------------------------------------
Expand Down

0 comments on commit d3297ac

Please sign in to comment.