merge trunk;
diff --git a/benchmark_test.go b/benchmark_test.go
index 7e96ae7..336243f 100644
--- a/benchmark_test.go
+++ b/benchmark_test.go
@@ -40,10 +40,10 @@
helper := FixtureHelper{sleep: 100000}
output := String{}
runConf := RunConf{
- Output: &output,
- Benchmark: true,
+ Output: &output,
+ Benchmark: true,
BenchmarkTime: 10000000,
- Filter: "Benchmark1",
+ Filter: "Benchmark1",
}
Run(&helper, &runConf)
c.Check(helper.calls[0], Equals, "SetUpSuite")
@@ -63,10 +63,10 @@
helper := FixtureHelper{sleep: 100000}
output := String{}
runConf := RunConf{
- Output: &output,
- Benchmark: true,
+ Output: &output,
+ Benchmark: true,
BenchmarkTime: 10000000,
- Filter: "Benchmark2",
+ Filter: "Benchmark2",
}
Run(&helper, &runConf)
diff --git a/foundation_test.go b/foundation_test.go
index 9f89150..12dfd36 100644
--- a/foundation_test.go
+++ b/foundation_test.go
@@ -301,14 +301,9 @@
logger = log.New(os.Stderr, "", 0)
logger = c
logger.Output(0, "Hello there")
- expected := "\\[LOG\\] [.0-9]+ Hello there\n"
+ expected := `\[LOG\] [0-9]+:[0-9][0-9]\.[0-9][0-9][0-9] +Hello there\n`
output := c.GetTestLog()
- matched, err := regexp.MatchString(expected, output)
- if err != nil {
- c.Error("Bad expression: ", expected)
- } else if !matched {
- c.Error("Output() didn't log properly:\n", output)
- }
+ c.Assert(output, gocheck.Matches, expected)
}
// -----------------------------------------------------------------------
diff --git a/gocheck.go b/gocheck.go
index 50af42e..90ad97e 100644
--- a/gocheck.go
+++ b/gocheck.go
@@ -81,6 +81,7 @@
reason string
mustFail bool
tempDir *tempDir
+ startTime time.Time
timer
}
@@ -613,13 +614,14 @@
logb = new(logger)
}
c := &C{
- method: method,
- kind: kind,
- logb: logb,
- logw: logw,
- tempDir: runner.tempDir,
- done: make(chan *C, 1),
- timer: timer{benchTime: runner.benchTime},
+ method: method,
+ kind: kind,
+ logb: logb,
+ logw: logw,
+ tempDir: runner.tempDir,
+ done: make(chan *C, 1),
+ timer: timer{benchTime: runner.benchTime},
+ startTime: time.Now(),
}
runner.tracker.expectCall(c)
go (func() {
diff --git a/helpers.go b/helpers.go
index fe4ca51..5b8b3fd 100644
--- a/helpers.go
+++ b/helpers.go
@@ -92,9 +92,12 @@
// Output enables *C to be used as a logger in functions that require only
// the minimum interface of *log.Logger.
func (c *C) Output(calldepth int, s string) error {
- ns := time.Now().Sub(time.Time{}).Nanoseconds()
- t := float64(ns%100e9) / 1e9
- c.Logf("[LOG] %.05f %s", t, s)
+ d := time.Now().Sub(c.startTime)
+ msec := d / time.Millisecond
+ sec := d / time.Second
+ min := d / time.Minute
+
+ c.Logf("[LOG] %d:%02d.%03d %s", min, sec%60, msec%1000, s)
return nil
}
diff --git a/run.go b/run.go
index dc75d77..9e08152 100644
--- a/run.go
+++ b/run.go
@@ -39,10 +39,10 @@
// module.
func TestingT(testingT *testing.T) {
conf := &RunConf{
- Filter: *filterFlag,
- Verbose: *verboseFlag,
- Stream: *streamFlag,
- Benchmark: *benchFlag,
+ Filter: *filterFlag,
+ Verbose: *verboseFlag,
+ Stream: *streamFlag,
+ Benchmark: *benchFlag,
BenchmarkTime: *benchTime,
}
if *listFlag {