Skip to content

Commit

Permalink
Test types.Binary#Value()
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Jul 5, 2024
1 parent 8cef107 commit 4698785
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions types/binary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,25 @@ func TestBinary_Scan(t *testing.T) {
})
}
}

func TestBinary_Value(t *testing.T) {
subtests := []struct {
name string
input Binary
output any
}{
{"empty", make(Binary, 0, 1), nil},
{"nul", Binary{0}, []byte{0}},
{"hex", Binary{10}, []byte{10}},
{"multiple", Binary{1, 254}, []byte{1, 254}},
}

for _, st := range subtests {
t.Run(st.name, func(t *testing.T) {
actual, err := st.input.Value()

require.NoError(t, err)
require.Equal(t, st.output, actual)
})
}
}

0 comments on commit 4698785

Please sign in to comment.