Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(54)

Delta Between Two Patch Sets: src/pkg/websocket/websocket_test.go

Issue 4893043: code review 4893043: url: new package (Closed)
Left Patch Set: Created 13 years, 8 months ago
Right Patch Set: diff -r a8d309fd526f https://go.googlecode.com/hg/ Created 13 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/websocket/client.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package websocket 5 package websocket
6 6
7 import ( 7 import (
8 "bufio" 8 "bufio"
9 "bytes" 9 "bytes"
10 "fmt" 10 "fmt"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 // If the client did not send a handshake that matches the protocol 152 // If the client did not send a handshake that matches the protocol
153 // specification, the server should abort the WebSocket connection. 153 // specification, the server should abort the WebSocket connection.
154 _, err := http.Get(fmt.Sprintf("http://%s/echo", serverAddr)) 154 _, err := http.Get(fmt.Sprintf("http://%s/echo", serverAddr))
155 if err == nil { 155 if err == nil {
156 t.Error("Get: unexpected success") 156 t.Error("Get: unexpected success")
157 return 157 return
158 } 158 }
159 urlerr, ok := err.(*url.Error) 159 urlerr, ok := err.(*url.Error)
160 if !ok { 160 if !ok {
161 » » t.Errorf("Get: not URL Error %#v", err) 161 » » t.Errorf("Get: not url.Error %#v", err)
162 return 162 return
163 } 163 }
164 if urlerr.Error != io.ErrUnexpectedEOF { 164 if urlerr.Error != io.ErrUnexpectedEOF {
165 t.Errorf("Get: error %#v", err) 165 t.Errorf("Get: error %#v", err)
166 return 166 return
167 } 167 }
168 } 168 }
169 169
170 func TestHTTPDraft75(t *testing.T) { 170 func TestHTTPDraft75(t *testing.T) {
171 once.Do(startServer) 171 once.Do(startServer)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 ws := newConn("http://127.0.0.1/", "ws://127.0.0.1/", "", bufio.NewReadW riter(br, bw), nil) 262 ws := newConn("http://127.0.0.1/", "ws://127.0.0.1/", "", bufio.NewReadW riter(br, bw), nil)
263 msg := make([]byte, 5) 263 msg := make([]byte, 5)
264 n, err := ws.Read(msg) 264 n, err := ws.Read(msg)
265 if err != nil { 265 if err != nil {
266 t.Errorf("Read: %v", err) 266 t.Errorf("Read: %v", err)
267 } 267 }
268 if !bytes.Equal(b[4:8], msg[0:n]) { 268 if !bytes.Equal(b[4:8], msg[0:n]) {
269 t.Errorf("Read: expected %q got %q", msg[4:8], msg[0:n]) 269 t.Errorf("Read: expected %q got %q", msg[4:8], msg[0:n])
270 } 270 }
271 } 271 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b