@@ -27,3 +27,36 @@ func TestStripNonAlphaNumeric(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestStripNonNumeric(t *testing.T) {
|
||||
type args struct {
|
||||
value string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "remove non numeric",
|
||||
args: args{
|
||||
value: "10, 560",
|
||||
},
|
||||
want: "10560",
|
||||
},
|
||||
{
|
||||
name: "remove nothing",
|
||||
args: args{
|
||||
value: "100",
|
||||
},
|
||||
want: "100",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := StripNonNumeric(tt.args.value); got != tt.want {
|
||||
t.Errorf("StripNonNumeric() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user