diff options
Diffstat (limited to 'src/pkg/testing')
| -rw-r--r-- | src/pkg/testing/iotest/logger.go | 12 | ||||
| -rw-r--r-- | src/pkg/testing/iotest/reader.go | 11 | ||||
| -rw-r--r-- | src/pkg/testing/iotest/writer.go | 8 | ||||
| -rw-r--r-- | src/pkg/testing/testing.go | 14 |
4 files changed, 22 insertions, 23 deletions
diff --git a/src/pkg/testing/iotest/logger.go b/src/pkg/testing/iotest/logger.go index 8ee574080..4eee6670b 100644 --- a/src/pkg/testing/iotest/logger.go +++ b/src/pkg/testing/iotest/logger.go @@ -11,8 +11,8 @@ import ( ) type writeLogger struct { - prefix string; - w io.Writer; + prefix string; + w io.Writer; } func (l *writeLogger) Write(p []byte) (n int, err os.Error) { @@ -29,12 +29,12 @@ func (l *writeLogger) Write(p []byte) (n int, err os.Error) { // that it logs (using log.Stdout) each write to standard output, // printing the prefix and the hexadecimal data written. func NewWriteLogger(prefix string, w io.Writer) io.Writer { - return &writeLogger{prefix, w} + return &writeLogger{prefix, w}; } type readLogger struct { - prefix string; - r io.Reader; + prefix string; + r io.Reader; } func (l *readLogger) Read(p []byte) (n int, err os.Error) { @@ -51,5 +51,5 @@ func (l *readLogger) Read(p []byte) (n int, err os.Error) { // that it logs (using log.Stdout) each write to standard output, // printing the prefix and the hexadecimal data written. func NewReadLogger(prefix string, r io.Reader) io.Reader { - return &readLogger{prefix, r} + return &readLogger{prefix, r}; } diff --git a/src/pkg/testing/iotest/reader.go b/src/pkg/testing/iotest/reader.go index c7ab6dc97..3a560966a 100644 --- a/src/pkg/testing/iotest/reader.go +++ b/src/pkg/testing/iotest/reader.go @@ -40,7 +40,7 @@ type halfReader struct { } func (r *halfReader) Read(p []byte) (int, os.Error) { - return r.r.Read(p[0:(len(p)+1)/2]); + return r.r.Read(p[0 : (len(p)+1)/2]); } @@ -52,9 +52,9 @@ func DataErrReader(r io.Reader) io.Reader { } type dataErrReader struct { - r io.Reader; - unread []byte; - data []byte; + r io.Reader; + unread []byte; + data []byte; } func (r *dataErrReader) Read(p []byte) (n int, err os.Error) { @@ -70,8 +70,7 @@ func (r *dataErrReader) Read(p []byte) (n int, err os.Error) { break; } n = bytes.Copy(p, r.unread); - r.unread = r.unread[n:len(r.unread)]; + r.unread = r.unread[n : len(r.unread)]; } return; } - diff --git a/src/pkg/testing/iotest/writer.go b/src/pkg/testing/iotest/writer.go index 7bd5ddda6..8b0e4ca8f 100644 --- a/src/pkg/testing/iotest/writer.go +++ b/src/pkg/testing/iotest/writer.go @@ -16,13 +16,13 @@ func TruncateWriter(w io.Writer, n int64) io.Writer { } type truncateWriter struct { - w io.Writer; - n int64; + w io.Writer; + n int64; } func (t *truncateWriter) Write(p []byte) (n int, err os.Error) { if t.n <= 0 { - return len(p), nil + return len(p), nil; } // real write n = len(p); @@ -34,5 +34,5 @@ func (t *truncateWriter) Write(p []byte) (n int, err os.Error) { if err == nil { n = len(p); } - return + return; } diff --git a/src/pkg/testing/testing.go b/src/pkg/testing/testing.go index 435d7af4b..df542e20b 100644 --- a/src/pkg/testing/testing.go +++ b/src/pkg/testing/testing.go @@ -30,12 +30,12 @@ func tabify(s string) string { s += "\n"; n++; } - for i := 0; i < n - 1; i++ { // -1 to avoid final newline + for i := 0; i < n-1; i++ { // -1 to avoid final newline if s[i] == '\n' { - return s[0:i+1] + "\t" + tabify(s[i+1:n]); + return s[0 : i+1]+"\t"+tabify(s[i+1 : n]); } } - return s + return s; } // T is a type passed to Test functions to manage test state and support formatted test logs. @@ -48,12 +48,12 @@ type T struct { // Fail marks the Test function as having failed but continues execution. func (t *T) Fail() { - t.failed = true + t.failed = true; } // Failed returns whether the Test function has failed. func (t *T) Failed() bool { - return t.failed + return t.failed; } // FailNow marks the Test function as having failed and stops its execution. @@ -103,8 +103,8 @@ func (t *T) Fatalf(format string, args ...) { // An internal type but exported because it is cross-package; part of the implementation // of gotest. type Test struct { - Name string; - F func(*T); + Name string; + F func(*T); } func tRunner(t *T, test *Test) { |
