cvc/src/loreal.com/dit/utils/sanitize_test.go

33 lines
660 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package utils
import "testing"
func TestSanitize(t *testing.T) {
type args struct {
s string
keepList []rune
}
tests := []struct {
name string
args args
want string
}{
// TODO: Add test cases.
{
name: "case1",
args: args{
s: "a+`~!@#$%^&-*/|\\//<>,.()[]{}vc123+_11你好啊————。《》【】·~@#¥%……&*=",
keepList: []rune{'_'},
},
want: "avc123_11你好啊",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := Sanitize(tt.args.s, tt.args.keepList...); got != tt.want {
t.Errorf("Sanitize() = %v, want %v", got, tt.want)
}
})
}
}