Skip to content

Commit c418235

Browse files
saurabhgamematloob
authored andcommitted
txtar: add UTF-8 test case in TestParse
Adds a new test case for the txtar package to verify that: Parse correctly handles UTF-8 characters in file contents. Leading comment lines are preserved properly. This improves test coverage for non-ASCII content and ensures comment parsing works as expected. Change-Id: I3eff5e09f6c3c588ca817c36178c9a7bafaa4ea7 GitHub-Last-Rev: 920f684 GitHub-Pull-Request: #600 Reviewed-on: https://go-review.googlesource.com/c/tools/+/712980 Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
1 parent a54c8a4 commit c418235

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

txtar/archive_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@ some content
5252
Files: []File{{"file", []byte("data\r\n")}},
5353
},
5454
},
55+
{
56+
name: "utf8 and comment",
57+
text: `# This is a test comment
58+
-- hello.txt --
59+
Hello
60+
-- unicode.txt --
61+
Go语言
62+
`,
63+
parsed: &Archive{
64+
Comment: []byte("# This is a test comment\n"),
65+
Files: []File{
66+
{"hello.txt", []byte("Hello\n")},
67+
{"unicode.txt", []byte("Go语言\n")},
68+
},
69+
},
70+
},
5571
}
5672
for _, tt := range tests {
5773
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)