github.com/binbinly/pkg@v0.0.11-0.20240321014439-f4fbf666eb0f/util/xfile/file_test.go (about) 1 package xfile 2 3 import "testing" 4 5 func TestExt(t *testing.T) { 6 type args struct { 7 filename string 8 } 9 tests := []struct { 10 name string 11 args args 12 want string 13 }{ 14 { 15 name: "ext", 16 args: args{filename: "1.txt"}, 17 want: "txt", 18 }, 19 } 20 for _, tt := range tests { 21 t.Run(tt.name, func(t *testing.T) { 22 if got := Ext(tt.args.filename); got != tt.want { 23 t.Errorf("Ext() = %v, want %v", got, tt.want) 24 } 25 }) 26 } 27 }