add tests case to prevent npe
This commit is contained in:
parent
eab0a26cc0
commit
ea0703e089
1 changed files with 28 additions and 0 deletions
28
object/service_test.go
Normal file
28
object/service_test.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package object
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestRequest(t *testing.T) {
|
||||
cases := []Request{
|
||||
&PutRequest{},
|
||||
&GetRequest{},
|
||||
&HeadRequest{},
|
||||
&SearchRequest{},
|
||||
&DeleteRequest{},
|
||||
&GetRangeRequest{},
|
||||
&GetRangeHashRequest{},
|
||||
}
|
||||
|
||||
for i := range cases {
|
||||
v := cases[i]
|
||||
|
||||
t.Run(fmt.Sprintf("%T", v), func(t *testing.T) {
|
||||
require.NotPanics(t, func() { v.CID() })
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue