mirror of
https://github.com/golang/go.git
synced 2025-05-30 11:51:34 +00:00
files that are okay from the last gofmt round
R=gri http://go/go-review/1015011
This commit is contained in:
parent
58ee1f5d54
commit
d2829faa7c
@ -190,5 +190,5 @@ func TestNRDiv(t *testing.T) {
|
|||||||
idiv(t, 7484890589595, 7484890589594);
|
idiv(t, 7484890589595, 7484890589594);
|
||||||
div(t, Fact(100), Fact(91));
|
div(t, Fact(100), Fact(91));
|
||||||
div(t, Fact(1000), Fact(991));
|
div(t, Fact(1000), Fact(991));
|
||||||
//div(t, Fact(10000), Fact(9991)); // takes too long - disabled for now
|
//div(t, Fact(10000), Fact(9991)); // takes too long - disabled for now
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
package bytes_test
|
package bytes_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "bytes";
|
. "bytes";
|
||||||
"rand";
|
"rand";
|
||||||
"testing";
|
"testing";
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
package bytes_test
|
package bytes_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "bytes";
|
. "bytes";
|
||||||
"strings";
|
"strings";
|
||||||
"testing";
|
"testing";
|
||||||
"unicode";
|
"unicode";
|
||||||
)
|
)
|
||||||
|
|
||||||
func eq(a, b []string) bool {
|
func eq(a, b []string) bool {
|
||||||
@ -241,18 +241,14 @@ func TestMap(t *testing.T) {
|
|||||||
// Run a couple of awful growth/shrinkage tests
|
// Run a couple of awful growth/shrinkage tests
|
||||||
a := tenRunes('a');
|
a := tenRunes('a');
|
||||||
// 1. Grow. This triggers two reallocations in Map.
|
// 1. Grow. This triggers two reallocations in Map.
|
||||||
maxRune := func(rune int) int {
|
maxRune := func(rune int) int { return unicode.MaxRune };
|
||||||
return unicode.MaxRune;
|
|
||||||
};
|
|
||||||
m := Map(maxRune, Bytes(a));
|
m := Map(maxRune, Bytes(a));
|
||||||
expect := tenRunes(unicode.MaxRune);
|
expect := tenRunes(unicode.MaxRune);
|
||||||
if string(m) != expect {
|
if string(m) != expect {
|
||||||
t.Errorf("growing: expected %q got %q", expect, m);
|
t.Errorf("growing: expected %q got %q", expect, m);
|
||||||
}
|
}
|
||||||
// 2. Shrink
|
// 2. Shrink
|
||||||
minRune := func(rune int) int {
|
minRune := func(rune int) int { return 'a' };
|
||||||
return 'a';
|
|
||||||
};
|
|
||||||
m = Map(minRune, Bytes(tenRunes(unicode.MaxRune)));
|
m = Map(minRune, Bytes(tenRunes(unicode.MaxRune)));
|
||||||
expect = a;
|
expect = a;
|
||||||
if string(m) != expect {
|
if string(m) != expect {
|
||||||
|
@ -174,7 +174,7 @@ func NewFile(r io.ReaderAt) (*File, os.Error) {
|
|||||||
switch f.Class {
|
switch f.Class {
|
||||||
case ELFCLASS32:
|
case ELFCLASS32:
|
||||||
case ELFCLASS64:
|
case ELFCLASS64:
|
||||||
// ok
|
// ok
|
||||||
default:
|
default:
|
||||||
return nil, &FormatError{0, "unknown ELF class", f.Class};
|
return nil, &FormatError{0, "unknown ELF class", f.Class};
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ func (e *newThreadError) String() string {
|
|||||||
return fmt.Sprintf("newThread wait wanted pid %v and signal %v, got %v and %v", e.Pid, e.StopSignal(), e.wantPid, e.wantSig);
|
return fmt.Sprintf("newThread wait wanted pid %v and signal %v, got %v and %v", e.Pid, e.StopSignal(), e.wantPid, e.wantSig);
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProcessExited struct {}
|
type ProcessExited struct{}
|
||||||
|
|
||||||
func (p ProcessExited) String() string {
|
func (p ProcessExited) String() string {
|
||||||
return "process exited";
|
return "process exited";
|
||||||
@ -449,9 +449,9 @@ func (t *thread) wait() {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// If we failed to continue, just let
|
// If we failed to continue, just let
|
||||||
// the stop go through so we can
|
// the stop go through so we can
|
||||||
// update the thread's state.
|
// update the thread's state.
|
||||||
}
|
}
|
||||||
if !<-t.proc.ready {
|
if !<-t.proc.ready {
|
||||||
// The monitor exited
|
// The monitor exited
|
||||||
@ -852,12 +852,8 @@ func (t *thread) stepAsync(ready chan os.Error) os.Error {
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
t.setState(singleStepping);
|
t.setState(singleStepping);
|
||||||
t.onStop(func() {
|
t.onStop(func() { ready <- nil },
|
||||||
ready <- nil;
|
func(err os.Error) { ready <- err });
|
||||||
},
|
|
||||||
func(err os.Error) {
|
|
||||||
ready <- err;
|
|
||||||
});
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1100,9 +1096,7 @@ func (p *process) WaitStop() os.Error {
|
|||||||
}
|
}
|
||||||
p.transitionHandlers.Push(h);
|
p.transitionHandlers.Push(h);
|
||||||
};
|
};
|
||||||
h.onErr = func(err os.Error) {
|
h.onErr = func(err os.Error) { ready <- err };
|
||||||
ready <- err;
|
|
||||||
};
|
|
||||||
p.transitionHandlers.Push(h);
|
p.transitionHandlers.Push(h);
|
||||||
return nil;
|
return nil;
|
||||||
});
|
});
|
||||||
@ -1114,9 +1108,7 @@ func (p *process) WaitStop() os.Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *process) Stop() os.Error {
|
func (p *process) Stop() os.Error {
|
||||||
err := p.do(func() os.Error {
|
err := p.do(func() os.Error { return p.stopAsync() });
|
||||||
return p.stopAsync();
|
|
||||||
});
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@ type typeDoc struct {
|
|||||||
//
|
//
|
||||||
type docReader struct {
|
type docReader struct {
|
||||||
doc *ast.CommentGroup; // package documentation, if any
|
doc *ast.CommentGroup; // package documentation, if any
|
||||||
pkgName string;
|
pkgName string;
|
||||||
values *vector.Vector; // list of *ast.GenDecl (consts and vars)
|
values *vector.Vector; // list of *ast.GenDecl (consts and vars)
|
||||||
types map[string]*typeDoc;
|
types map[string]*typeDoc;
|
||||||
funcs map[string]*ast.FuncDecl;
|
funcs map[string]*ast.FuncDecl;
|
||||||
bugs *vector.Vector; // list of *ast.CommentGroup
|
bugs *vector.Vector; // list of *ast.CommentGroup
|
||||||
@ -186,7 +186,7 @@ func (doc *docReader) addFunc(fun *ast.FuncDecl) {
|
|||||||
if doc.pkgName == "os" && tname == "Error" &&
|
if doc.pkgName == "os" && tname == "Error" &&
|
||||||
name != "NewError" && name != "NewSyscallError" {
|
name != "NewError" && name != "NewSyscallError" {
|
||||||
// not a factory function for os.Error
|
// not a factory function for os.Error
|
||||||
doc.funcs[name] = fun; // treat as ordinary function
|
doc.funcs[name] = fun; // treat as ordinary function
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ func (doc *docReader) addDecl(decl ast.Decl) {
|
|||||||
// would lose GenDecl documentation if the TypeSpec
|
// would lose GenDecl documentation if the TypeSpec
|
||||||
// has documentation as well.
|
// has documentation as well.
|
||||||
doc.addType(&ast.GenDecl{d.Doc, d.Pos(), token.TYPE, noPos, []ast.Spec{spec}, noPos});
|
doc.addType(&ast.GenDecl{d.Doc, d.Pos(), token.TYPE, noPos, []ast.Spec{spec}, noPos});
|
||||||
// A new GenDecl node is created, no need to nil out d.Doc.
|
// A new GenDecl node is created, no need to nil out d.Doc.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ func (d *decoder) idatReader(idat io.Reader) os.Error {
|
|||||||
pdat := pr[1:len(pr)];
|
pdat := pr[1:len(pr)];
|
||||||
switch cr[0] {
|
switch cr[0] {
|
||||||
case ftNone:
|
case ftNone:
|
||||||
// No-op.
|
// No-op.
|
||||||
case ftSub:
|
case ftSub:
|
||||||
for i := bpp; i < len(cdat); i++ {
|
for i := bpp; i < len(cdat); i++ {
|
||||||
cdat[i] += cdat[i-bpp];
|
cdat[i] += cdat[i-bpp];
|
||||||
|
@ -57,8 +57,8 @@ func Exec(argv0 string, argv []string, envv []string) Error {
|
|||||||
|
|
||||||
// Waitmsg stores the information about an exited process as reported by Wait.
|
// Waitmsg stores the information about an exited process as reported by Wait.
|
||||||
type Waitmsg struct {
|
type Waitmsg struct {
|
||||||
Pid int; // The process's id.
|
Pid int; // The process's id.
|
||||||
syscall.WaitStatus; // System-dependent status info.
|
syscall.WaitStatus; // System-dependent status info.
|
||||||
Rusage *syscall.Rusage; // System-dependent resource usage info.
|
Rusage *syscall.Rusage; // System-dependent resource usage info.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
package os_test
|
package os_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "os";
|
. "os";
|
||||||
"testing";
|
"testing";
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMkdirAll(t *testing.T) {
|
func TestMkdirAll(t *testing.T) {
|
||||||
|
@ -134,9 +134,9 @@ func TestExt(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Node struct {
|
type Node struct {
|
||||||
name string;
|
name string;
|
||||||
entries []*Node; // nil if the entry is a file
|
entries []*Node; // nil if the entry is a file
|
||||||
mark int;
|
mark int;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tree = &Node{
|
var tree = &Node{
|
||||||
@ -156,13 +156,13 @@ var tree = &Node{
|
|||||||
&Node{"u", nil, 0},
|
&Node{"u", nil, 0},
|
||||||
&Node{"v", nil, 0},
|
&Node{"v", nil, 0},
|
||||||
},
|
},
|
||||||
0
|
0,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
0
|
0,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
0
|
0,
|
||||||
}
|
}
|
||||||
|
|
||||||
func walkTree(n *Node, path string, f func(path string, n *Node)) {
|
func walkTree(n *Node, path string, f func(path string, n *Node)) {
|
||||||
@ -187,9 +187,7 @@ func makeTree(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func markTree(n *Node) {
|
func markTree(n *Node) {
|
||||||
walkTree(n, "", func(path string, n *Node) {
|
walkTree(n, "", func(path string, n *Node) { n.mark++ });
|
||||||
n.mark++;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkMarks(t *testing.T) {
|
func checkMarks(t *testing.T) {
|
||||||
@ -210,7 +208,7 @@ func mark(name string) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
type TestVisitor struct {}
|
type TestVisitor struct{}
|
||||||
|
|
||||||
func (v *TestVisitor) VisitDir(path string, d *os.Dir) bool {
|
func (v *TestVisitor) VisitDir(path string, d *os.Dir) bool {
|
||||||
mark(d.Name);
|
mark(d.Name);
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
package strconv_test
|
package strconv_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "strconv";
|
. "strconv";
|
||||||
"testing";
|
"testing";
|
||||||
)
|
)
|
||||||
|
|
||||||
type shiftTest struct {
|
type shiftTest struct {
|
||||||
|
@ -59,9 +59,7 @@ func plus1(v interface{}) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func writer(f func(interface{}) string) (func(io.Writer, interface{}, string)) {
|
func writer(f func(interface{}) string) (func(io.Writer, interface{}, string)) {
|
||||||
return func(w io.Writer, v interface{}, format string) {
|
return func(w io.Writer, v interface{}, format string) { io.WriteString(w, f(v)) };
|
||||||
io.WriteString(w, f(v));
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
package time_test
|
package time_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os";
|
"os";
|
||||||
"testing";
|
"testing";
|
||||||
. "time";
|
. "time";
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -217,7 +217,7 @@ func setupZone() {
|
|||||||
case len(tz) > 0:
|
case len(tz) > 0:
|
||||||
zones, _ = readinfofile(zoneDir+tz);
|
zones, _ = readinfofile(zoneDir+tz);
|
||||||
case len(tz) == 0:
|
case len(tz) == 0:
|
||||||
// do nothing: use UTC
|
// do nothing: use UTC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
package unicode_test
|
package unicode_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing";
|
"testing";
|
||||||
. "unicode";
|
. "unicode";
|
||||||
)
|
)
|
||||||
|
|
||||||
type T struct {
|
type T struct {
|
||||||
@ -98,7 +98,8 @@ var inTest = []T{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var outTest = []T{ // not really worth being thorough
|
var outTest = []T{ // not really worth being thorough
|
||||||
T{0x20, "Telugu"}}
|
T{0x20, "Telugu"},
|
||||||
|
}
|
||||||
|
|
||||||
var inCategoryTest = []T{
|
var inCategoryTest = []T{
|
||||||
T{0x0081, "Cc"},
|
T{0x0081, "Cc"},
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
package utf8_test
|
package utf8_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes";
|
"bytes";
|
||||||
"strings";
|
"strings";
|
||||||
"testing";
|
"testing";
|
||||||
. "utf8";
|
. "utf8";
|
||||||
)
|
)
|
||||||
|
|
||||||
type Utf8Map struct {
|
type Utf8Map struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user