Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Kubernetes-commit: 0d825361e6d31171b77a00665fdb63816b8b6e00
This commit is contained in:
Charles-Edouard Brétéché 2024-10-24 21:57:51 +02:00 committed by Kubernetes Publisher
parent 15220968e1
commit b432ca9bc1
1 changed files with 16 additions and 0 deletions

View File

@ -18,6 +18,9 @@ package cel
import (
"testing"
"github.com/google/cel-go/common/types"
"github.com/stretchr/testify/assert"
)
func TestTypes_ListType(t *testing.T) {
@ -77,3 +80,16 @@ func testValue(t *testing.T, id int64, val interface{}) *DynValue {
}
return dv
}
func TestDeclTypeProvider_FindStructType(t *testing.T) {
obj := NewObjectType("foo", map[string]*DeclField{
"bar": NewDeclField("bar", StringType, true, nil, nil),
})
base := types.NewEmptyRegistry()
provider := NewDeclTypeProvider(obj)
provider, err := provider.WithTypeProvider(base)
assert.NoError(t, err)
wrappedType, found := provider.FindStructType("foo")
assert.True(t, found)
assert.Equal(t, types.TypeKind, wrappedType.Kind())
}