diff options
| author | Ondřej Surý <ondrej@sury.org> | 2011-02-18 09:50:58 +0100 | 
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2011-02-18 09:50:58 +0100 | 
| commit | c072558b90f1bbedc2022b0f30c8b1ac4712538e (patch) | |
| tree | 67767591619e4bd8111fb05fac185cde94fb7378 /src/pkg/testing/testing.go | |
| parent | 5859517b767c99749a45651c15d4bae5520ebae8 (diff) | |
| download | golang-c072558b90f1bbedc2022b0f30c8b1ac4712538e.tar.gz | |
Imported Upstream version 2011.02.15upstream/2011.02.15
Diffstat (limited to 'src/pkg/testing/testing.go')
| -rw-r--r-- | src/pkg/testing/testing.go | 8 | 
1 files changed, 6 insertions, 2 deletions
| diff --git a/src/pkg/testing/testing.go b/src/pkg/testing/testing.go index 0e04935ce..edbf0847c 100644 --- a/src/pkg/testing/testing.go +++ b/src/pkg/testing/testing.go @@ -43,6 +43,7 @@ import (  	"fmt"  	"os"  	"runtime" +	"time"  )  // Report as tests are run; default is silent for success. @@ -153,16 +154,19 @@ func Main(matchString func(pat, str string) (bool, os.Error), tests []InternalTe  		if *chatty {  			println("=== RUN ", tests[i].Name)  		} +		ns := -time.Nanoseconds()  		t := new(T)  		t.ch = make(chan *T)  		go tRunner(t, &tests[i])  		<-t.ch +		ns += time.Nanoseconds() +		tstr := fmt.Sprintf("(%.1f seconds)", float64(ns)/1e9)  		if t.failed { -			println("--- FAIL:", tests[i].Name) +			println("--- FAIL:", tests[i].Name, tstr)  			print(t.errors)  			ok = false  		} else if *chatty { -			println("--- PASS:", tests[i].Name) +			println("--- PASS:", tests[i].Name, tstr)  			print(t.errors)  		}  	} | 
