From 6fbbce55b4e407c8836440b0580b03e4066924cf Mon Sep 17 00:00:00 2001 From: Arseny Balobanov Date: Fri, 13 Mar 2020 00:12:46 +0300 Subject: [PATCH] Rewrite require.Nil(t, err) with require.NoError(t, err). --- digitalclock/main_test.go | 6 +++--- tools/testtool/freeport_test.go | 4 ++-- .../submissions/correct/sum/private/sum/sum_private_test.go | 2 +- .../brokenstyle/private/brokenstyle/sum_private_test.go | 2 +- .../brokentest/private/brokentest/sum_private_test.go | 2 +- .../newdependency/private/newdependency/sum_private_test.go | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/digitalclock/main_test.go b/digitalclock/main_test.go index dcb2d79..cf10f7f 100644 --- a/digitalclock/main_test.go +++ b/digitalclock/main_test.go @@ -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) } diff --git a/tools/testtool/freeport_test.go b/tools/testtool/freeport_test.go index 2189fb7..3c9e584 100644 --- a/tools/testtool/freeport_test.go +++ b/tools/testtool/freeport_test.go @@ -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)) } diff --git a/tools/testtool/testdata/submissions/correct/sum/private/sum/sum_private_test.go b/tools/testtool/testdata/submissions/correct/sum/private/sum/sum_private_test.go index 51d8825..526f814 100644 --- a/tools/testtool/testdata/submissions/correct/sum/private/sum/sum_private_test.go +++ b/tools/testtool/testdata/submissions/correct/sum/private/sum/sum_private_test.go @@ -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) diff --git a/tools/testtool/testdata/submissions/incorrect/brokenstyle/private/brokenstyle/sum_private_test.go b/tools/testtool/testdata/submissions/incorrect/brokenstyle/private/brokenstyle/sum_private_test.go index d51f782..0fd61be 100644 --- a/tools/testtool/testdata/submissions/incorrect/brokenstyle/private/brokenstyle/sum_private_test.go +++ b/tools/testtool/testdata/submissions/incorrect/brokenstyle/private/brokenstyle/sum_private_test.go @@ -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) diff --git a/tools/testtool/testdata/submissions/incorrect/brokentest/private/brokentest/sum_private_test.go b/tools/testtool/testdata/submissions/incorrect/brokentest/private/brokentest/sum_private_test.go index 7878f07..d3d265d 100644 --- a/tools/testtool/testdata/submissions/incorrect/brokentest/private/brokentest/sum_private_test.go +++ b/tools/testtool/testdata/submissions/incorrect/brokentest/private/brokentest/sum_private_test.go @@ -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) diff --git a/tools/testtool/testdata/submissions/incorrect/newdependency/private/newdependency/sum_private_test.go b/tools/testtool/testdata/submissions/incorrect/newdependency/private/newdependency/sum_private_test.go index e9b2d9a..ec91678 100644 --- a/tools/testtool/testdata/submissions/incorrect/newdependency/private/newdependency/sum_private_test.go +++ b/tools/testtool/testdata/submissions/incorrect/newdependency/private/newdependency/sum_private_test.go @@ -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)