Live: pipeline rule crud (file-based, still for MVP) (#39238)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package pattern
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValid(t *testing.T) {
|
||||
type args struct {
|
||||
pattern string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "valid",
|
||||
args: args{
|
||||
pattern: "xxx",
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "invalid",
|
||||
args: args{
|
||||
pattern: "/xxx",
|
||||
},
|
||||
want: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, _ := Valid(tt.args.pattern)
|
||||
if got != tt.want {
|
||||
t.Errorf("Valid() got = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user