mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 18:37:05 +00:00
security fix on macros - new users will have it but previous users should force-update or wait for v11.2.0
Former-commit-id: 74fe5f646656e54db14a64bd24c319ff2aefd889
This commit is contained in:
@@ -450,4 +450,22 @@ func TestConvertBuilderFunc(t *testing.T) {
|
||||
if !evalFunc([]string{"1", "[name1,name2]"}).Call([]reflect.Value{reflect.ValueOf("ok")})[0].Interface().(bool) {
|
||||
t.Fatalf("failed, it should fail already")
|
||||
}
|
||||
|
||||
fnSimplify := func(requestParamValue string) bool {
|
||||
return requestParamValue == "kataras"
|
||||
}
|
||||
|
||||
evalFunc = convertBuilderFunc(fnSimplify)
|
||||
if !evalFunc([]string{}).Call([]reflect.Value{reflect.ValueOf("kataras")})[0].Interface().(bool) {
|
||||
t.Fatalf("it should pass, the combile arguments are empty and the given request value is the expected one")
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
t.Fatalf("it should panic, the combile arguments are more than one")
|
||||
}
|
||||
}()
|
||||
|
||||
// should panic.
|
||||
evalFunc([]string{"1"}).Call([]reflect.Value{reflect.ValueOf("kataras")})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user