aboutsummaryrefslogtreecommitdiff
path: root/hotline/file_path_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'hotline/file_path_test.go')
-rw-r--r--hotline/file_path_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/hotline/file_path_test.go b/hotline/file_path_test.go
index ee0cbac..c86a8d9 100644
--- a/hotline/file_path_test.go
+++ b/hotline/file_path_test.go
@@ -152,6 +152,29 @@ func Test_readPath(t *testing.T) {
},
want: "/usr/local/var/mobius/Files",
},
+ {
+ name: "when fileRoot contains non-ASCII UTF-8 characters",
+ args: args{
+ fileRoot: "/files/español",
+ filePath: nil,
+ fileName: []byte("foo"),
+ },
+ want: "/files/español/foo",
+ },
+ {
+ name: "when fileRoot contains non-ASCII and filePath has Mac Roman bytes",
+ args: args{
+ fileRoot: "/files/español",
+ filePath: []byte{
+ 0x00, 0x01,
+ 0x00, 0x00,
+ 0x06,
+ 0x63, 0x61, 0x66, 0x8e, 0x73, 0x21, // "caf\x8es!" where 0x8e is Mac Roman é
+ },
+ fileName: []byte("foo"),
+ },
+ want: "/files/español/cafés!/foo",
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {