Skip to content

Commit

Permalink
clean up test
Browse files Browse the repository at this point in the history
  • Loading branch information
redaLaanait committed Sep 16, 2024
1 parent a6b9db7 commit c45059c
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions schema_compatibility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -978,13 +978,12 @@ func TestSchemaCompatibility_ResolveWithComplexUnion(t *testing.T) {
}

func TestSchemaCompatibility_ResolveWithFieldMissingInWriterAndReaderStruct(t *testing.T) {

w := avro.MustParse(`{
"type":"record", "name":"test", "namespace": "org.hamba.avro",
"fields":[
{"name": "a", "type": "string"}
]
}`)
"type":"record", "name":"test", "namespace": "org.hamba.avro",
"fields":[
{"name": "a", "type": "string"}
]
}`)

r := avro.MustParse(`{
"type":"record", "name":"test", "namespace": "org.hamba.avro",
Expand All @@ -995,25 +994,25 @@ func TestSchemaCompatibility_ResolveWithFieldMissingInWriterAndReaderStruct(t *t
]
}`)

type TW struct {
type TestW struct {
A string `avro:"a"`
}
value := TW{A: "abc"}
value := TestW{A: "abc"}

b, err := avro.Marshal(w, value)
assert.NoError(t, err)

sch, err := avro.NewSchemaCompatibility().Resolve(r, w)
schema, err := avro.NewSchemaCompatibility().Resolve(r, w)
assert.NoError(t, err)

type TR struct {
type TestR struct {
A string `avro:"a"`
C string `avro:"c"`
}
want := TR{A: "abc", C: "foo"}
want := TestR{A: "abc", C: "foo"}

var result TR
err = avro.Unmarshal(sch, b, &result)
var result TestR
err = avro.Unmarshal(schema, b, &result)
assert.NoError(t, err)

assert.Equal(t, want, result)
Expand Down

0 comments on commit c45059c

Please sign in to comment.