diff options
author | EuAndreh <eu@euandre.org> | 2024-08-10 16:15:22 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-08-10 16:29:52 -0300 |
commit | 4e67c5da9a8aabeeac7f4891e64ad5f5e727083c (patch) | |
tree | f82f053a3ea37939bc28acb92d6191441f656a30 /tests/wscat.go | |
parent | src/wscat.go: Remove client support (diff) | |
download | wscat-4e67c5da9a8aabeeac7f4891e64ad5f5e727083c.tar.gz wscat-4e67c5da9a8aabeeac7f4891e64ad5f5e727083c.tar.xz |
src/wscat.go: Remove deprecated code
Diffstat (limited to 'tests/wscat.go')
-rw-r--r-- | tests/wscat.go | 86 |
1 files changed, 7 insertions, 79 deletions
diff --git a/tests/wscat.go b/tests/wscat.go index 80317ed..17ee9e2 100644 --- a/tests/wscat.go +++ b/tests/wscat.go @@ -313,11 +313,6 @@ func (w dataBeforeHandshakeResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter return c, rw, err } -// Copyright 2014 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - - var hostPortNoPortTests = []struct { u *url.URL hostPort, hostNoPort string @@ -410,10 +405,6 @@ func TestValidCompressionLevel(t *testing.T) { } } } -// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - // broadcastBench allows to run broadcast benchmarks. // In every broadcast benchmark we create many connections, then send the same @@ -533,10 +524,6 @@ func BenchmarkBroadcast(b *testing.B) { }) } } -// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - var _ net.Error = errWriteTimeout @@ -1122,16 +1109,6 @@ func TestAddrs(t *testing.T) { } } -func TestDeprecatedUnderlyingConn(t *testing.T) { - var b1, b2 bytes.Buffer - fc := fakeNetConn{Reader: &b1, Writer: &b2} - c := newConn(fc, true, 1024, 1024, nil, nil, nil) - ul := c.UnderlyingConn() - if ul != fc { - t.Fatalf("Underlying conn is not what it should be.") - } -} - func TestNetConn(t *testing.T) { var b1, b2 bytes.Buffer fc := fakeNetConn{Reader: &b1, Writer: &b2} @@ -1264,10 +1241,6 @@ func TestFailedConnectionReadPanic(t *testing.T) { } t.Fatal("should not get here") } -// Copyright 2019 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - func TestJoinMessages(t *testing.T) { messages := []string{"a", "bc", "def", "ghij", "klmno", "0", "12", "345", "6789"} @@ -1292,10 +1265,6 @@ func TestJoinMessages(t *testing.T) { } } } -// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - func TestJSON(t *testing.T) { var buf bytes.Buffer @@ -1375,37 +1344,8 @@ func TestPartialJSONRead(t *testing.T) { } } -func TestDeprecatedJSON(t *testing.T) { - var buf bytes.Buffer - wc := newTestConn(nil, &buf, true) - rc := newTestConn(&buf, nil, false) - - var actual, expect struct { - A int - B string - } - expect.A = 1 - expect.B = "hello" - - if err := WriteJSON(wc, &expect); err != nil { - t.Fatal("write", err) - } - - if err := ReadJSON(rc, &actual); err != nil { - t.Fatal("read", err) - } - - if !reflect.DeepEqual(&actual, &expect) { - t.Fatal("equal", actual, expect) - } -} -// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of -// this source code is governed by a BSD-style license that can be found in the -// LICENSE file. - // !appengine - func maskBytesByByte(key [4]byte, pos int, b []byte) int { for i := range b { b[i] ^= key[pos&3] @@ -1465,10 +1405,6 @@ func BenchmarkMaskBytes(b *testing.B) { }) } } -// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - var preparedMessageTests = []struct { messageType int @@ -1538,10 +1474,6 @@ func TestPreparedMessage(t *testing.T) { } } } -// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - var subprotocolTests = []struct { h string @@ -1696,10 +1628,6 @@ func TestHijack_NotSupported(t *testing.T) { t.Fatalf("got err=%T and status_code=%d", err, recorder.Code) } } -// Copyright 2014 The Gorilla WebSocket Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - var equalASCIIFoldTests = []struct { t, s string @@ -1805,11 +1733,11 @@ func TestParseExtensions(t *testing.T) { } } -func TestParseArgs(t *testing.T) { +func test_parseArgs() { given := parseArgs([]string { "x", "y", "z" }) - expected := CLIArgs { - FromAddr: "y", - ToAddr: "z", + expected := _CLIArgs { + fromAddr: "y", + toAddr: "z", } g.AssertEqual(given, expected) @@ -1818,6 +1746,9 @@ func TestParseArgs(t *testing.T) { func MainTest() { + test_parseArgs() + + tests := []testing.InternalTest { { "TestBadMethod", TestBadMethod }, { "TestNoUpgrade", TestNoUpgrade }, @@ -1837,7 +1768,6 @@ func MainTest() { { "TestWriteAfterMessageWriterClose", TestWriteAfterMessageWriterClose }, { "TestReadLimit", TestReadLimit }, { "TestAddrs", TestAddrs }, - { "TestDeprecatedUnderlyingConn", TestDeprecatedUnderlyingConn }, { "TestNetConn", TestNetConn }, { "TestBufioReadBytes", TestBufioReadBytes }, { "TestCloseError", TestCloseError }, @@ -1847,7 +1777,6 @@ func MainTest() { { "TestJoinMessages", TestJoinMessages }, { "TestJSON", TestJSON }, { "TestPartialJSONRead", TestPartialJSONRead }, - { "TestDeprecatedJSON", TestDeprecatedJSON }, { "TestMaskBytes", TestMaskBytes }, { "TestPreparedMessage", TestPreparedMessage }, { "TestSubprotocols", TestSubprotocols }, @@ -1859,7 +1788,6 @@ func MainTest() { { "TestTokenListContainsValue", TestTokenListContainsValue }, { "TestIsValidChallengeKey", TestIsValidChallengeKey }, { "TestParseExtensions", TestParseExtensions }, - { "TestParseArgs", TestParseArgs }, } // FIXME: run benchmarks |