gitee.com/quant1x/gox@v1.21.2/runtime/recover_test.go (about) 1 package runtime 2 3 import "testing" 4 5 func Test_sprintf(t *testing.T) { 6 type args struct { 7 v []any 8 } 9 tests := []struct { 10 name string 11 args args 12 want string 13 }{ 14 { 15 name: "çİş", 16 args: args{v: []any{}}, 17 want: "", 18 }, 19 { 20 name: "1-int", 21 args: args{v: []any{5}}, 22 want: "5", 23 }, 24 { 25 name: "1-string", 26 args: args{v: []any{"2"}}, 27 want: "2", 28 }, 29 } 30 for _, tt := range tests { 31 t.Run(tt.name, func(t *testing.T) { 32 if got := sprintf(tt.args.v...); got != tt.want { 33 t.Errorf("sprintf() = %v, want %v", got, tt.want) 34 } 35 }) 36 } 37 }