Rewrite require.Nil(t, err) with require.NoError(t, err).

This commit is contained in:
Arseny Balobanov 2020-03-13 00:12:46 +03:00
parent 3c9b875d53
commit 6fbbce55b4
6 changed files with 9 additions and 9 deletions

View file

@ -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"))
img, err := png.Decode(resp.Body)
require.Nil(t, err)
require.NoError(t, err)
return img
}
@ -125,7 +125,7 @@ func TestDigitalClock_valid(t *testing.T) {
defer stop()
files, err := ioutil.ReadDir("./testdata")
require.Nil(t, err)
require.NoError(t, err)
c := &http.Client{Timeout: time.Second * 10}
@ -171,7 +171,7 @@ func TestDigitalClock_invalid(t *testing.T) {
testName := func(tc *TestCase) string {
data, err := json.Marshal(tc)
require.Nil(t, err)
require.NoError(t, err)
return string(data)
}

View file

@ -22,9 +22,9 @@ func TestWaitForPort(t *testing.T) {
defer s.Close()
u, err := url.Parse(s.URL)
require.Nil(t, err)
require.NoError(t, err)
_, port, err := net.SplitHostPort(u.Host)
require.Nil(t, err)
require.NoError(t, err)
require.NoError(t, WaitForPort(t, time.Second, port))
}

View file

@ -36,7 +36,7 @@ func readTestCases(filename string) ([]*testCase, error) {
func TestSumPrivate(t *testing.T) {
tests, err := readTestCases("./testdata/tests.csv")
require.Nil(t, err)
require.NoError(t, err)
for _, tc := range tests {
s := Sum(tc.a, tc.b)

View file

@ -36,7 +36,7 @@ func readTestCases(filename string) ([]*testCase, error) {
func TestSumPrivate(t *testing.T) {
tests, err := readTestCases("./testdata/tests.csv")
require.Nil(t, err)
require.NoError(t, err)
for _, tc := range tests {
s := Sum(tc.a, tc.b)

View file

@ -36,7 +36,7 @@ func readTestCases(filename string) ([]*testCase, error) {
func TestSumPrivate(t *testing.T) {
tests, err := readTestCases("./testdata/tests.csv")
require.Nil(t, err)
require.NoError(t, err)
for _, tc := range tests {
s := Sum(tc.a, tc.b)

View file

@ -36,7 +36,7 @@ func readTestCases(filename string) ([]*testCase, error) {
func TestSumPrivate(t *testing.T) {
tests, err := readTestCases("./testdata/tests.csv")
require.Nil(t, err)
require.NoError(t, err)
for _, tc := range tests {
s := Sum(tc.a, tc.b)