This commit is contained in:
yun
2026-08-15 01:38:05 +08:00
parent 139330aee2
commit eb8f660ab5
57 changed files with 5401 additions and 1438 deletions
+20
View File
@@ -0,0 +1,20 @@
package mailx
import "testing"
func TestFileBaseName(t *testing.T) {
cases := []struct{ in, want string }{
{"dir/file.txt", "file.txt"},
{`dir\file.txt`, "file.txt"},
{"/a/b/c.txt", "c.txt"},
{"file.txt", "file.txt"},
{"", "attachment"},
{"/", "attachment"},
{".", "attachment"},
}
for _, c := range cases {
if got := fileBaseName(c.in); got != c.want {
t.Errorf("fileBaseName(%q) = %q, want %q", c.in, got, c.want)
}
}
}