diff --git a/client/httpuils_test.go b/client/httpuils_test.go index 580a7acf8..dfb660120 100644 --- a/client/httpuils_test.go +++ b/client/httpuils_test.go @@ -23,31 +23,41 @@ import ( func TestParseHost(t *testing.T) { tests := []struct { - name string - host string - expect error + name string + host string + expected error }{ { - name: "http host", - host: "http://github.com", - expect: nil, + name: "tcp host", + host: "tcp://github.com", + expected: nil, }, { - name: "https host", - host: "https://github.com", - expect: nil, + name: "unix host", + host: "unix://github.com", + expected: nil, }, { - name: "not support url scheme", - host: "wss://github.com", - expect: errors.New("not support url scheme wss"), + name: "http host", + host: "http://github.com", + expected: nil, + }, + { + name: "https host", + host: "https://github.com", + expected: nil, + }, + { + name: "not support url scheme", + host: "wss://github.com", + expected: errors.New("not support url scheme wss"), }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { _, _, _, err := ParseHost(tt.host) - if (nil == err) != (nil == tt.expect) { - t.Errorf("expect: %v, got: %v\n", tt.expect, err) + if (nil == err) != (nil == tt.expected) { + t.Errorf("expected: %v, got: %v\n", tt.expected, err) } }) } diff --git a/dfget/core/api/download_api_test.go b/dfget/core/api/download_api_test.go index 5201e3629..640ac6b8e 100644 --- a/dfget/core/api/download_api_test.go +++ b/dfget/core/api/download_api_test.go @@ -36,6 +36,7 @@ func (s *DownloadAPITestSuite) TestGetRealRange(c *check.C) { rangeValue string expected string }{ + {"", "0-1", ""}, {"0-1", "", "0-1"}, {"0-1", "1-100", "1-2"}, {"0-100", "1-100", "1-100"}, diff --git a/pkg/atomiccount/atomiccount_test.go b/pkg/atomiccount/atomiccount_test.go index 5f9a92ee1..9fcf3642a 100644 --- a/pkg/atomiccount/atomiccount_test.go +++ b/pkg/atomiccount/atomiccount_test.go @@ -39,6 +39,9 @@ func (suite *AtomicCountUtilSuite) TestAdd(c *check.C) { result := acount.Get() c.Check(result, check.Equals, (int32)(12)) + + var nilAcount *AtomicInt + c.Check(nilAcount.Add(5), check.Equals, (int32)(0)) } func (suite *AtomicCountUtilSuite) TestSet(c *check.C) { @@ -49,4 +52,7 @@ func (suite *AtomicCountUtilSuite) TestSet(c *check.C) { _ = acount.Set(1) result := acount.Get() c.Check(result, check.Equals, (int32)(1)) + + var nilAcount *AtomicInt + c.Check(nilAcount.Get(), check.Equals, (int32)(0)) }