]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Tidy up
authorMatt Joiner <anacrolix@gmail.com>
Thu, 20 Mar 2014 11:02:15 +0000 (22:02 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 20 Mar 2014 11:02:15 +0000 (22:02 +1100)
testutil/testutil.go
tracker/udp/udp_tracker_test.go

index 4dba814491d3f7a6ac1e4100850be5caa41712be..4a150b08f4982e31d03ea9aabd42489f5d15784e 100644 (file)
@@ -1,3 +1,8 @@
+// Package testutil contains stuff for testing torrent-related behaviour.
+//
+// "greeting" is a single-file torrent of a file called "greeting" that
+// "contains "hello, world\n".
+
 package testutil
 
 import (
@@ -31,6 +36,9 @@ func CreateMetaInfo(name string, w io.Writer) {
        <-errs
 }
 
+// Gives a temporary directory containing the completed "greeting" torrent,
+// and a corresponding metainfo describing it. The temporary directory can be
+// cleaned away with os.RemoveAll.
 func GreetingTestTorrent() (tempDir string, metaInfo *metainfo.MetaInfo) {
        tempDir, err := ioutil.TempDir(os.TempDir(), "")
        if err != nil {
index 51b6dad7a97d773e8e2a737017b11840d2de7df4..4d3a9b0d8464d96662765964ea3bf6513b4a9bce 100644 (file)
@@ -98,19 +98,10 @@ func TestUDPTracker(t *testing.T) {
        }
        rand.Read(req.PeerId[:])
        copy(req.InfoHash[:], []uint8{0xa3, 0x56, 0x41, 0x43, 0x74, 0x23, 0xe6, 0x26, 0xd9, 0x38, 0x25, 0x4a, 0x6b, 0x80, 0x49, 0x10, 0xa6, 0x67, 0xa, 0xc1})
-       // TODO: Find out what torrent this info hash corresponds to.
-       // n, err := hex.Decode(req.InfoHash[:], []byte("c833bb2b5e7bcb9c07f4c020b4be430c28ba7cdb"))
-       // if err != nil {
-       //      t.Fatal(err)
-       // }
-       // if n != len(req.InfoHash) {
-       //      panic("nope")
-       // }
-       resp, err := tr.Announce(&req)
+       _, err = tr.Announce(&req)
        if err != nil {
                t.Fatal(err)
        }
-       t.Log(resp)
 }
 
 func TestAnnounceRandomInfoHash(t *testing.T) {