idiv(t, 7484890589595, 7484890589594);
div(t, Fact(100), Fact(91));
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
}
package bytes_test
import (
- . "bytes";
- "rand";
- "testing";
+ . "bytes";
+ "rand";
+ "testing";
)
package bytes_test
import (
- . "bytes";
- "strings";
- "testing";
- "unicode";
+ . "bytes";
+ "strings";
+ "testing";
+ "unicode";
)
func eq(a, b []string) bool {
// Run a couple of awful growth/shrinkage tests
a := tenRunes('a');
// 1. Grow. This triggers two reallocations in Map.
- maxRune := func(rune int) int {
- return unicode.MaxRune;
- };
+ maxRune := func(rune int) int { return unicode.MaxRune };
m := Map(maxRune, Bytes(a));
expect := tenRunes(unicode.MaxRune);
if string(m) != expect {
t.Errorf("growing: expected %q got %q", expect, m);
}
// 2. Shrink
- minRune := func(rune int) int {
- return 'a';
- };
+ minRune := func(rune int) int { return 'a' };
m = Map(minRune, Bytes(tenRunes(unicode.MaxRune)));
expect = a;
if string(m) != expect {
switch f.Class {
case ELFCLASS32:
case ELFCLASS64:
- // ok
+ // ok
default:
return nil, &FormatError{0, "unknown ELF class", f.Class};
}
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 {
return "process exited";
if err == nil {
continue;
}
- // If we failed to continue, just let
- // the stop go through so we can
- // update the thread's state.
+ // If we failed to continue, just let
+ // the stop go through so we can
+ // update the thread's state.
}
if !<-t.proc.ready {
// The monitor exited
return err;
}
t.setState(singleStepping);
- t.onStop(func() {
- ready <- nil;
- },
- func(err os.Error) {
- ready <- err;
- });
+ t.onStop(func() { ready <- nil },
+ func(err os.Error) { ready <- err });
return nil;
}
}
p.transitionHandlers.Push(h);
};
- h.onErr = func(err os.Error) {
- ready <- err;
- };
+ h.onErr = func(err os.Error) { ready <- err };
p.transitionHandlers.Push(h);
return nil;
});
}
func (p *process) Stop() os.Error {
- err := p.do(func() os.Error {
- return p.stopAsync();
- });
+ err := p.do(func() os.Error { return p.stopAsync() });
if err != nil {
return err;
}
//
type docReader struct {
doc *ast.CommentGroup; // package documentation, if any
- pkgName string;
- values *vector.Vector; // list of *ast.GenDecl (consts and vars)
+ pkgName string;
+ values *vector.Vector; // list of *ast.GenDecl (consts and vars)
types map[string]*typeDoc;
funcs map[string]*ast.FuncDecl;
bugs *vector.Vector; // list of *ast.CommentGroup
if doc.pkgName == "os" && tname == "Error" &&
name != "NewError" && name != "NewSyscallError" {
// not a factory function for os.Error
- doc.funcs[name] = fun; // treat as ordinary function
+ doc.funcs[name] = fun; // treat as ordinary function
return;
}
// would lose GenDecl documentation if the TypeSpec
// has documentation as well.
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.
}
}
}
pdat := pr[1:len(pr)];
switch cr[0] {
case ftNone:
- // No-op.
+ // No-op.
case ftSub:
for i := bpp; i < len(cdat); i++ {
cdat[i] += cdat[i-bpp];
// Waitmsg stores the information about an exited process as reported by Wait.
type Waitmsg struct {
- Pid int; // The process's id.
- syscall.WaitStatus; // System-dependent status info.
+ Pid int; // The process's id.
+ syscall.WaitStatus; // System-dependent status info.
Rusage *syscall.Rusage; // System-dependent resource usage info.
}
package os_test
import (
- . "os";
- "testing";
+ . "os";
+ "testing";
)
func TestMkdirAll(t *testing.T) {
}
type Node struct {
- name string;
- entries []*Node; // nil if the entry is a file
- mark int;
+ name string;
+ entries []*Node; // nil if the entry is a file
+ mark int;
}
var tree = &Node{
&Node{"u", 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 markTree(n *Node) {
- walkTree(n, "", func(path string, n *Node) {
- n.mark++;
- });
+ walkTree(n, "", func(path string, n *Node) { n.mark++ });
}
func checkMarks(t *testing.T) {
});
}
-type TestVisitor struct {}
+type TestVisitor struct{}
func (v *TestVisitor) VisitDir(path string, d *os.Dir) bool {
mark(d.Name);
package strconv_test
import (
- . "strconv";
- "testing";
+ . "strconv";
+ "testing";
)
type shiftTest struct {
}
func writer(f func(interface{}) string) (func(io.Writer, interface{}, string)) {
- return func(w io.Writer, v interface{}, format string) {
- io.WriteString(w, f(v));
- };
+ return func(w io.Writer, v interface{}, format string) { io.WriteString(w, f(v)) };
}
package time_test
import (
- "os";
- "testing";
- . "time";
+ "os";
+ "testing";
+ . "time";
)
func init() {
case len(tz) > 0:
zones, _ = readinfofile(zoneDir+tz);
case len(tz) == 0:
- // do nothing: use UTC
+ // do nothing: use UTC
}
}
package unicode_test
import (
- "testing";
- . "unicode";
+ "testing";
+ . "unicode";
)
type T struct {
}
var outTest = []T{ // not really worth being thorough
-T{0x20, "Telugu"}}
+ T{0x20, "Telugu"},
+}
var inCategoryTest = []T{
T{0x0081, "Cc"},
package utf8_test
import (
- "bytes";
- "strings";
- "testing";
- . "utf8";
+ "bytes";
+ "strings";
+ "testing";
+ . "utf8";
)
type Utf8Map struct {