mirror of
				https://github.com/golang/go.git
				synced 2025-11-04 10:40:57 +00:00 
			
		
		
		
	testing: fix timing format inconsistency
Fixes #8175. LGTM=r R=golang-codereviews, r, gobot CC=golang-codereviews https://golang.org/cl/103320043
This commit is contained in:
		
							parent
							
								
									7dcbf4f353
								
							
						
					
					
						commit
						0e92b538a9
					
				
					 2 changed files with 13 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -71,7 +71,7 @@ func runExample(eg InternalExample) (ok bool) {
 | 
			
		|||
 | 
			
		||||
	// Clean up in a deferred call so we can recover if the example panics.
 | 
			
		||||
	defer func() {
 | 
			
		||||
		d := time.Now().Sub(start)
 | 
			
		||||
		dstr := fmtDuration(time.Now().Sub(start))
 | 
			
		||||
 | 
			
		||||
		// Close pipe, restore stdout, get output.
 | 
			
		||||
		w.Close()
 | 
			
		||||
| 
						 | 
				
			
			@ -84,10 +84,10 @@ func runExample(eg InternalExample) (ok bool) {
 | 
			
		|||
			fail = fmt.Sprintf("got:\n%s\nwant:\n%s\n", g, e)
 | 
			
		||||
		}
 | 
			
		||||
		if fail != "" || err != nil {
 | 
			
		||||
			fmt.Printf("--- FAIL: %s (%v)\n%s", eg.Name, d, fail)
 | 
			
		||||
			fmt.Printf("--- FAIL: %s (%s)\n%s", eg.Name, dstr, fail)
 | 
			
		||||
			ok = false
 | 
			
		||||
		} else if *chatty {
 | 
			
		||||
			fmt.Printf("--- PASS: %s (%v)\n", eg.Name, d)
 | 
			
		||||
			fmt.Printf("--- PASS: %s (%s)\n", eg.Name, dstr)
 | 
			
		||||
		}
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			panic(err)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue