Rewrite require.Nil(t, err) with require.NoError(t, err).
This commit is contained in:
parent
3c9b875d53
commit
6fbbce55b4
6 changed files with 9 additions and 9 deletions
|
@ -115,7 +115,7 @@ func queryImage(t *testing.T, c *http.Client, url string) image.Image {
|
||||||
require.Equal(t, "image/png", resp.Header.Get("Content-Type"))
|
require.Equal(t, "image/png", resp.Header.Get("Content-Type"))
|
||||||
|
|
||||||
img, err := png.Decode(resp.Body)
|
img, err := png.Decode(resp.Body)
|
||||||
require.Nil(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
return img
|
return img
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ func TestDigitalClock_valid(t *testing.T) {
|
||||||
defer stop()
|
defer stop()
|
||||||
|
|
||||||
files, err := ioutil.ReadDir("./testdata")
|
files, err := ioutil.ReadDir("./testdata")
|
||||||
require.Nil(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
c := &http.Client{Timeout: time.Second * 10}
|
c := &http.Client{Timeout: time.Second * 10}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ func TestDigitalClock_invalid(t *testing.T) {
|
||||||
|
|
||||||
testName := func(tc *TestCase) string {
|
testName := func(tc *TestCase) string {
|
||||||
data, err := json.Marshal(tc)
|
data, err := json.Marshal(tc)
|
||||||
require.Nil(t, err)
|
require.NoError(t, err)
|
||||||
return string(data)
|
return string(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,9 @@ func TestWaitForPort(t *testing.T) {
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
u, err := url.Parse(s.URL)
|
u, err := url.Parse(s.URL)
|
||||||
require.Nil(t, err)
|
require.NoError(t, err)
|
||||||
_, port, err := net.SplitHostPort(u.Host)
|
_, port, err := net.SplitHostPort(u.Host)
|
||||||
require.Nil(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
require.NoError(t, WaitForPort(t, time.Second, port))
|
require.NoError(t, WaitForPort(t, time.Second, port))
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ func readTestCases(filename string) ([]*testCase, error) {
|
||||||
|
|
||||||
func TestSumPrivate(t *testing.T) {
|
func TestSumPrivate(t *testing.T) {
|
||||||
tests, err := readTestCases("./testdata/tests.csv")
|
tests, err := readTestCases("./testdata/tests.csv")
|
||||||
require.Nil(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
s := Sum(tc.a, tc.b)
|
s := Sum(tc.a, tc.b)
|
||||||
|
|
|
@ -36,7 +36,7 @@ func readTestCases(filename string) ([]*testCase, error) {
|
||||||
|
|
||||||
func TestSumPrivate(t *testing.T) {
|
func TestSumPrivate(t *testing.T) {
|
||||||
tests, err := readTestCases("./testdata/tests.csv")
|
tests, err := readTestCases("./testdata/tests.csv")
|
||||||
require.Nil(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
s := Sum(tc.a, tc.b)
|
s := Sum(tc.a, tc.b)
|
||||||
|
|
|
@ -36,7 +36,7 @@ func readTestCases(filename string) ([]*testCase, error) {
|
||||||
|
|
||||||
func TestSumPrivate(t *testing.T) {
|
func TestSumPrivate(t *testing.T) {
|
||||||
tests, err := readTestCases("./testdata/tests.csv")
|
tests, err := readTestCases("./testdata/tests.csv")
|
||||||
require.Nil(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
s := Sum(tc.a, tc.b)
|
s := Sum(tc.a, tc.b)
|
||||||
|
|
|
@ -36,7 +36,7 @@ func readTestCases(filename string) ([]*testCase, error) {
|
||||||
|
|
||||||
func TestSumPrivate(t *testing.T) {
|
func TestSumPrivate(t *testing.T) {
|
||||||
tests, err := readTestCases("./testdata/tests.csv")
|
tests, err := readTestCases("./testdata/tests.csv")
|
||||||
require.Nil(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
s := Sum(tc.a, tc.b)
|
s := Sum(tc.a, tc.b)
|
||||||
|
|
Loading…
Reference in a new issue