buildr/modules/state/key_test.go
Peter 1261932bdc
All checks were successful
continuous-integration/drone/push Build is passing
refactor: apply golangci-lint findings
2023-06-22 19:16:00 +02:00

40 lines
653 B
Go

package state_test
import (
"errors"
"testing"
"code.icb4dc0.de/buildr/buildr/modules/state"
)
func TestStringsKey_Hash(t *testing.T) {
t.Parallel()
tests := []struct {
want func(k []byte) error
name string
k []any
}{
{
name: "Empty key",
k: nil,
want: func(k []byte) error {
if len(k) != 0 {
return errors.New("expected empty key")
}
return nil
},
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
got := state.KeyOfStrings(tt.k...).Bytes()
if err := tt.want(got); err != nil {
t.Errorf("Bytes() = %v, err = %v", got, err)
}
})
}
}