IsSubtype more tests (#3299)

Adding more tests as I'm tracking down issues
This commit is contained in:
Erik Arvidsson
2017-03-28 15:13:21 -07:00
committed by GitHub
parent 3b82ab4ef1
commit 1d56b95b21
+13
View File
@@ -390,6 +390,19 @@ func TestIsSubtypeCompoundUnion(tt *testing.T) {
func TestIsSubtypeOptionalFields(tt *testing.T) {
assert := assert.New(tt)
s1 := MakeStructType2("", StructField{"a", NumberType, true})
s2 := MakeStructType2("", StructField{"a", NumberType, false})
assert.True(IsSubtype(s1, s2))
assert.False(IsSubtype(s2, s1))
s3 := MakeStructType2("", StructField{"a", StringType, false})
assert.False(IsSubtype(s1, s3))
assert.False(IsSubtype(s3, s1))
s4 := MakeStructType2("", StructField{"a", StringType, true})
assert.False(IsSubtype(s1, s4))
assert.False(IsSubtype(s4, s1))
makeType := func(s string) *Type {
if s == "" {
return MakeStructType2("")