1) Change default gofmt default settings for

parsing and printing to new syntax.

   Use -oldparser to parse the old syntax,
   use -oldprinter to print the old syntax.

2) Change default gofmt formatting settings
   to use tabs for indentation only and to use
   spaces for alignment. This will make the code
   alignment insensitive to an editor's tabwidth.

   Use -spaces=false to use tabs for alignment.

3) Manually changed src/exp/parser/parser_test.go
   so that it doesn't try to parse the parser's
   source files using the old syntax (they have
   new syntax now).

4) gofmt -w src misc test/bench

5th and last set of files.

R=rsc
CC=golang-dev
https://golang.org/cl/180050
This commit is contained in:
Robert Griesemer 2009-12-15 15:41:46 -08:00
parent d65a5cce89
commit 45ca9f7a9e
59 changed files with 5907 additions and 5907 deletions

View file

@ -5,57 +5,57 @@
package websocket
import (
"bytes";
"http";
"io";
"log";
"net";
"once";
"strings";
"testing";
"bytes"
"http"
"io"
"log"
"net"
"once"
"strings"
"testing"
)
var serverAddr string
func echoServer(ws *Conn) { io.Copy(ws, ws) }
func echoServer(ws *Conn) { io.Copy(ws, ws) }
func startServer() {
l, e := net.Listen("tcp", ":0"); // any available address
l, e := net.Listen("tcp", ":0") // any available address
if e != nil {
log.Exitf("net.Listen tcp :0 %v", e)
}
serverAddr = l.Addr().String();
log.Stderr("Test WebSocket server listening on ", serverAddr);
http.Handle("/echo", Handler(echoServer));
go http.Serve(l, nil);
serverAddr = l.Addr().String()
log.Stderr("Test WebSocket server listening on ", serverAddr)
http.Handle("/echo", Handler(echoServer))
go http.Serve(l, nil)
}
func TestEcho(t *testing.T) {
once.Do(startServer);
once.Do(startServer)
client, err := net.Dial("tcp", "", serverAddr);
client, err := net.Dial("tcp", "", serverAddr)
if err != nil {
t.Fatal("dialing", err)
}
ws, err := newClient("/echo", "localhost", "http://localhost",
"ws://localhost/echo", "", client);
"ws://localhost/echo", "", client)
if err != nil {
t.Errorf("WebSocket handshake error", err);
return;
t.Errorf("WebSocket handshake error", err)
return
}
msg := strings.Bytes("hello, world\n");
msg := strings.Bytes("hello, world\n")
if _, err := ws.Write(msg); err != nil {
t.Errorf("Write: error %v", err)
}
var actual_msg = make([]byte, 512);
n, err := ws.Read(actual_msg);
var actual_msg = make([]byte, 512)
n, err := ws.Read(actual_msg)
if err != nil {
t.Errorf("Read: error %v", err)
}
actual_msg = actual_msg[0:n];
actual_msg = actual_msg[0:n]
if !bytes.Equal(msg, actual_msg) {
t.Errorf("Echo: expected %q got %q", msg, actual_msg)
}
ws.Close();
ws.Close()
}