mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-06 03:08:11 +08:00
fix: use require for error assertions (testifylint)
This commit is contained in:
parent
1eb3a54158
commit
7df2142389
@ -2954,7 +2954,7 @@ func TestContextGetRawDataNilBody(t *testing.T) {
|
||||
|
||||
data, err := c.GetRawData()
|
||||
assert.Nil(t, data)
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
assert.Equal(t, "cannot read nil body", err.Error())
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -151,7 +152,7 @@ func TestMarshalXMLforHSuccess(t *testing.T) {
|
||||
"key2": 123,
|
||||
}
|
||||
data, err := xml.Marshal(h)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Contains(t, string(data), "<key1>value1</key1>")
|
||||
assert.Contains(t, string(data), "<key2>123</key2>")
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user