Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2002)

Delta Between Two Patch Sets: gocheck_test.go

Issue 5874049: use readable time stamps on log messages.
Left Patch Set: use readable time stamps on log messages. Created 11 years, 7 months ago
Right Patch Set: use readable time stamps on log messages. Created 10 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « gocheck.go ('k') | helpers.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // This file contains just a few generic helpers which are used by the 1 // This file contains just a few generic helpers which are used by the
2 // other test files. 2 // other test files.
3 3
4 package gocheck_test 4 package gocheck_test
5 5
6 import ( 6 import (
7 "flag" 7 "flag"
8 "fmt" 8 "fmt"
9 "launchpad.net/gocheck" 9 "launchpad.net/gocheck"
10 "os" 10 "os"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 type SuccessHelper struct{} 87 type SuccessHelper struct{}
88 88
89 func (s *SuccessHelper) TestLogAndSucceed(c *gocheck.C) { 89 func (s *SuccessHelper) TestLogAndSucceed(c *gocheck.C) {
90 c.Log("Expected success!") 90 c.Log("Expected success!")
91 } 91 }
92 92
93 // ----------------------------------------------------------------------- 93 // -----------------------------------------------------------------------
94 // Helper suite for testing ordering and behavior of fixture. 94 // Helper suite for testing ordering and behavior of fixture.
95 95
96 type FixtureHelper struct { 96 type FixtureHelper struct {
97 » calls [64]string 97 » calls []string
98 » n int
99 panicOn string 98 panicOn string
100 skip bool 99 skip bool
101 skipOnN int 100 skipOnN int
102 sleepOn string 101 sleepOn string
103 sleep time.Duration 102 sleep time.Duration
104 bytes int64 103 bytes int64
105 } 104 }
106 105
107 func (s *FixtureHelper) trace(name string, c *gocheck.C) { 106 func (s *FixtureHelper) trace(name string, c *gocheck.C) {
108 » n := s.n 107 » s.calls = append(s.calls, name)
109 » s.calls[n] = name
110 » s.n += 1
111 if name == s.panicOn { 108 if name == s.panicOn {
112 panic(name) 109 panic(name)
113 } 110 }
114 if s.sleep > 0 && s.sleepOn == name { 111 if s.sleep > 0 && s.sleepOn == name {
115 time.Sleep(s.sleep) 112 time.Sleep(s.sleep)
116 } 113 }
117 » if s.skip && s.skipOnN == n { 114 » if s.skip && s.skipOnN == len(s.calls)-1 {
118 c.Skip("skipOnN == n") 115 c.Skip("skipOnN == n")
119 } 116 }
120 } 117 }
121 118
122 func (s *FixtureHelper) SetUpSuite(c *gocheck.C) { 119 func (s *FixtureHelper) SetUpSuite(c *gocheck.C) {
123 s.trace("SetUpSuite", c) 120 s.trace("SetUpSuite", c)
124 } 121 }
125 122
126 func (s *FixtureHelper) TearDownSuite(c *gocheck.C) { 123 func (s *FixtureHelper) TearDownSuite(c *gocheck.C) {
127 s.trace("TearDownSuite", c) 124 s.trace("TearDownSuite", c)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 expected.name, result, expected.result) 187 expected.name, result, expected.result)
191 } 188 }
192 if failed != expected.failed { 189 if failed != expected.failed {
193 if failed { 190 if failed {
194 c.Errorf("%s has failed when it shouldn't", expected.nam e) 191 c.Errorf("%s has failed when it shouldn't", expected.nam e)
195 } else { 192 } else {
196 c.Errorf("%s has not failed when it should", expected.na me) 193 c.Errorf("%s has not failed when it should", expected.na me)
197 } 194 }
198 } 195 }
199 } 196 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b