[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [meek/master] Can use bytes.Reader, don't need bytes.Buffer.



commit 5848703da3fbf48b4d67b5abd48171cd4935dca7
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Tue Mar 5 16:19:50 2019 -0700

    Can use bytes.Reader, don't need bytes.Buffer.
---
 meek-client-torbrowser/protocol_test.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meek-client-torbrowser/protocol_test.go b/meek-client-torbrowser/protocol_test.go
index e127c4f..63e48d2 100644
--- a/meek-client-torbrowser/protocol_test.go
+++ b/meek-client-torbrowser/protocol_test.go
@@ -53,13 +53,13 @@ func TestGrepHelperAddr(t *testing.T) {
 		"meek-http-helper: listen " + expectedAddr + " \n",
 		"meek-http-helper: listen " + expectedAddr + "abc\n",
 	} {
-		b := bytes.NewBufferString(test)
+		b := bytes.NewReader([]byte(test))
 		s, err := grepHelperAddrTimeout(b)
 		if err != io.EOF {
 			t.Errorf("%q â?? (%q, %v), should have been %v", test, s, err, io.EOF)
 		}
 		// test again with an endless reader
-		b = bytes.NewBufferString(test)
+		b = bytes.NewReader([]byte(test))
 		s, err = grepHelperAddrTimeout(io.MultiReader(b, &infiniteReader{}))
 		if err != errTimedout {
 			t.Errorf("%q â?? (%q, %v), should have been %v", test, s, err, errTimedout)
@@ -73,13 +73,13 @@ func TestGrepHelperAddr(t *testing.T) {
 		"junk\nmeek-http-helper: listen " + expectedAddr + "\njunk",
 		"meek-http-helper: listen " + expectedAddr + "\nmeek-http-helper: listen 1.2.3.4:9999\n",
 	} {
-		b := bytes.NewBufferString(test)
+		b := bytes.NewReader([]byte(test))
 		s, err := grepHelperAddrTimeout(b)
 		if err != nil || s != expectedAddr {
 			t.Errorf("%q â?? (%q, %v), should have been %q", test, s, err, expectedAddr)
 		}
 		// test again with an endless reader
-		b = bytes.NewBufferString(test)
+		b = bytes.NewReader([]byte(test))
 		s, err = grepHelperAddrTimeout(io.MultiReader(b, &infiniteReader{}))
 		if err != nil || s != expectedAddr {
 			t.Errorf("%q â?? (%q, %v), should have been %q", test, s, err, expectedAddr)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits