mirror of https://github.com/databricks/cli.git
This commit is contained in:
parent
7c70179091
commit
39efb705de
|
@ -566,22 +566,3 @@ func TestDocIngestionForTopLevelPrimitive(t *testing.T) {
|
|||
|
||||
assert.Equal(t, expectedSchema, string(jsonSchema))
|
||||
}
|
||||
|
||||
func TestErrorOnMapWithoutStringKey(t *testing.T) {
|
||||
type Foo struct {
|
||||
Bar map[int]string `json:"bar"`
|
||||
}
|
||||
elem := Foo{}
|
||||
_, err := New(reflect.TypeOf(elem), nil)
|
||||
assert.ErrorContains(t, err, "only strings map keys are valid. key type: int")
|
||||
}
|
||||
|
||||
func TestErrorIfStructRefersToItself(t *testing.T) {
|
||||
type Foo struct {
|
||||
MyFoo *Foo `json:"my_foo"`
|
||||
}
|
||||
|
||||
elem := Foo{}
|
||||
_, err := New(reflect.TypeOf(elem), nil)
|
||||
assert.ErrorContains(t, err, "cycle detected. traversal trace: root -> my_foo")
|
||||
}
|
||||
|
|
|
@ -379,3 +379,9 @@ func TestFromTypeSelfReferential(t *testing.T) {
|
|||
// t.Log("[DEBUG] actual: ", string(jsonSchema))
|
||||
// t.Log("[DEBUG] expected: ", string(expectedJson))
|
||||
}
|
||||
|
||||
func TestFromTypeError(t *testing.T) {
|
||||
type mapOfInts map[int]int
|
||||
_, err := FromType(reflect.TypeOf(mapOfInts{}), nil)
|
||||
assert.EqualError(t, err, "found map with non-string key: int")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue