X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Ftx_test.go;h=9f8d7506b652ee04d25dd739d8a573e0a64ca079;hb=HEAD;hp=9c061ee0fe8c8628590b031736c2874a49427a46;hpb=cf9363f956cb2d93a581c11ed65c5b02910d10d5;p=nncp.git diff --git a/src/tx_test.go b/src/tx_test.go index 9c061ee..2dccbc3 100644 --- a/src/tx_test.go +++ b/src/tx_test.go @@ -21,9 +21,8 @@ import ( "bytes" "crypto/rand" "io" - "io/ioutil" "os" - "path" + "path/filepath" "testing" "testing/quick" @@ -48,7 +47,7 @@ func TestTx(t *testing.T) { pathSrc = pathSrc[:MaxPathSize] } hops = hops % 4 - spool, err := ioutil.TempDir("", "testtx") + spool, err := os.MkdirTemp("", "testtx") if err != nil { panic(err) } @@ -64,7 +63,7 @@ func TestTx(t *testing.T) { nodeTgt := nodeTgtOur.Their() ctx := Ctx{ Spool: spool, - LogPath: path.Join(spool, "log.log"), + LogPath: filepath.Join(spool, "log.log"), Debug: true, Self: nodeOur, SelfId: nodeOur.Id, @@ -86,6 +85,9 @@ func TestTx(t *testing.T) { nodeTgt.Via = append(nodeTgt.Via, node.Id) } pkt, err := NewPkt(PktTypeExec, replyNice, []byte(pathSrc)) + if err != nil { + panic(err) + } src := bytes.NewReader(data) dstNode, _, _, err := ctx.Tx( nodeTgt, @@ -148,14 +150,14 @@ func TestTx(t *testing.T) { if !bytes.HasPrefix(pkt.Path[:], []byte(pathSrc)) { return false } - if bytes.Compare(bufR.Bytes(), []byte(data)) != 0 { + if !bytes.Equal(bufR.Bytes(), []byte(data)) { return false } } else { if pkt.Type != PktTypeTrns { return false } - if bytes.Compare(pkt.Path[:MTHSize], vias[i+1][:]) != 0 { + if !bytes.Equal(pkt.Path[:MTHSize], vias[i+1][:]) { return false } }