client_test.go | 11 +++++------ connection_test.go | 14 ++++---------- misc_test.go | 12 ++++++++---- diff --git a/client_test.go b/client_test.go index 13e7ac8e5972478bf88bfcd27afc9a5f0e3acbf1..5e416fb42bb92625ed9d123fa95b0005dc6df69d 100644 --- a/client_test.go +++ b/client_test.go @@ -17,7 +17,6 @@ "github.com/anacrolix/utp" "github.com/bradfitz/iter" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/check.v1" "github.com/anacrolix/torrent/bencode" "github.com/anacrolix/torrent/data" @@ -308,21 +307,21 @@ assert.Equal(t, case_.readaheadPieces, pieces, "%v", case_) } } -func (suite) TestMergingTrackersByAddingSpecs(c *check.C) { +func TestMergingTrackersByAddingSpecs(t *testing.T) { cl, _ := NewClient(&TestingConfig) defer cl.Close() spec := TorrentSpec{} T, new, _ := cl.AddTorrentSpec(&spec) if !new { - c.FailNow() + t.FailNow() } spec.Trackers = [][]string{{"http://a"}, {"udp://b"}} _, new, _ = cl.AddTorrentSpec(&spec) if new { - c.FailNow() + t.FailNow() } - c.Assert(T.Trackers[0][0].URL(), check.Equals, "http://a") - c.Assert(T.Trackers[1][0].URL(), check.Equals, "udp://b") + assert.EqualValues(t, T.Trackers[0][0].URL(), "http://a") + assert.EqualValues(t, T.Trackers[1][0].URL(), "udp://b") } type badData struct { diff --git a/connection_test.go b/connection_test.go index 1ffb9aef3fb65005d1482f136e40f43867a161e4..3749a6ca68fc8cc1a4f28e9ff606b5d422468eb0 100644 --- a/connection_test.go +++ b/connection_test.go @@ -5,7 +5,7 @@ "testing" "time" "github.com/bradfitz/iter" - . "gopkg.in/check.v1" + "github.com/stretchr/testify/assert" "github.com/anacrolix/torrent/internal/pieceordering" "github.com/anacrolix/torrent/peer_protocol" @@ -60,18 +60,12 @@ } return } -func testRequestOrder(expected []int, ro *pieceordering.Instance, t *C) { - t.Assert(pieceOrderingAsSlice(ro), DeepEquals, expected) +func testRequestOrder(expected []int, ro *pieceordering.Instance, t *testing.T) { + assert.EqualValues(t, pieceOrderingAsSlice(ro), expected) } -type suite struct{} - -var _ = Suite(suite{}) - -func Test(t *testing.T) { TestingT(t) } - // Tests the request ordering based on a connections priorities. -func (suite) TestPieceRequestOrder(t *C) { +func TestPieceRequestOrder(t *testing.T) { c := connection{ pieceRequestOrder: pieceordering.New(), piecePriorities: []int{1, 4, 0, 3, 2}, diff --git a/misc_test.go b/misc_test.go index 55cd3c66fc07e927b46c09fee46d55c3713bb272..17ee31338e36ee500682759b7de1eb5e7379919c 100644 --- a/misc_test.go +++ b/misc_test.go @@ -1,12 +1,16 @@ package torrent -import . "gopkg.in/check.v1" +import ( + "testing" -func (suite) TestTorrentOffsetRequest(c *C) { + "github.com/stretchr/testify/assert" +) + +func TestTorrentOffsetRequest(t *testing.T) { check := func(tl, ps, off int64, expected request, ok bool) { req, _ok := torrentOffsetRequest(tl, ps, defaultChunkSize, off) - c.Check(_ok, Equals, ok) - c.Check(req, Equals, expected) + assert.Equal(t, _ok, ok) + assert.Equal(t, req, expected) } check(13, 5, 0, newRequest(0, 0, 5), true) check(13, 5, 3, newRequest(0, 0, 5), true)