mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 06:15:45 +00:00
add test
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
parent
1518c4ec16
commit
0d825361e6
@ -18,6 +18,9 @@ package cel
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/google/cel-go/common/types"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTypes_ListType(t *testing.T) {
|
func TestTypes_ListType(t *testing.T) {
|
||||||
@ -77,3 +80,16 @@ func testValue(t *testing.T, id int64, val interface{}) *DynValue {
|
|||||||
}
|
}
|
||||||
return dv
|
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())
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user