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

Delta Between Two Patch Sets: foundation_test.go

Issue 5874049: use readable time stamps on log messages.
Left Patch Set: use readable time stamps on log messages. Created 12 years 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 | « bootstrap_test.go ('k') | gocheck.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 // These tests check that the foundations of gocheck are working properly. 1 // These tests check that the foundations of gocheck are working properly.
2 // They already assume that fundamental failing is working already, though, 2 // They already assume that fundamental failing is working already, though,
3 // since this was tested in bootstrap_test.go. Even then, some care may 3 // since this was tested in bootstrap_test.go. Even then, some care may
4 // still have to be taken when using external functions, since they should 4 // still have to be taken when using external functions, since they should
5 // of course not rely on functionality tested here. 5 // of course not rely on functionality tested here.
6 6
7 package gocheck_test 7 package gocheck_test
8 8
9 import ( 9 import (
10 "fmt" 10 "fmt"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 c.Assert(result.ExpectedFailures, gocheck.Equals, 1) 235 c.Assert(result.ExpectedFailures, gocheck.Equals, 1)
236 } 236 }
237 237
238 func (s *FoundationS) TestExpectFailureSucceedVerbose(c *gocheck.C) { 238 func (s *FoundationS) TestExpectFailureSucceedVerbose(c *gocheck.C) {
239 helper := ExpectFailureSucceedHelper{} 239 helper := ExpectFailureSucceedHelper{}
240 output := String{} 240 output := String{}
241 result := gocheck.Run(&helper, &gocheck.RunConf{Output: &output, Verbose : true}) 241 result := gocheck.Run(&helper, &gocheck.RunConf{Output: &output, Verbose : true})
242 242
243 expected := "" + 243 expected := "" +
244 "FAIL EXPECTED: foundation_test\\.go:[0-9]+:" + 244 "FAIL EXPECTED: foundation_test\\.go:[0-9]+:" +
245 » » " ExpectFailureSucceedHelper\\.TestSucceed \\(It booms!\\)\n" 245 » » " ExpectFailureSucceedHelper\\.TestSucceed \\(It booms!\\)\t *[. 0-9]+s\n"
246 246
247 matched, err := regexp.MatchString(expected, output.value) 247 matched, err := regexp.MatchString(expected, output.value)
248 if err != nil { 248 if err != nil {
249 c.Error("Bad expression: ", expected) 249 c.Error("Bad expression: ", expected)
250 } else if !matched { 250 } else if !matched {
251 c.Error("ExpectFailure() didn't log properly:\n", output.value) 251 c.Error("ExpectFailure() didn't log properly:\n", output.value)
252 } 252 }
253 253
254 c.Assert(result.ExpectedFailures, gocheck.Equals, 1) 254 c.Assert(result.ExpectedFailures, gocheck.Equals, 1)
255 } 255 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 type minLogger interface { 295 type minLogger interface {
296 Output(calldepth int, s string) error 296 Output(calldepth int, s string) error
297 } 297 }
298 298
299 func (s *BootstrapS) TestMinLogger(c *gocheck.C) { 299 func (s *BootstrapS) TestMinLogger(c *gocheck.C) {
300 var logger minLogger 300 var logger minLogger
301 logger = log.New(os.Stderr, "", 0) 301 logger = log.New(os.Stderr, "", 0)
302 logger = c 302 logger = c
303 logger.Output(0, "Hello there") 303 logger.Output(0, "Hello there")
304 » expected := `\[LOG\] [0-9]+(\.[0-9]+)?[mun]?s +Hello there\n` 304 » expected := `\[LOG\] [0-9]+:[0-9][0-9]\.[0-9][0-9][0-9] +Hello there\n`
305 output := c.GetTestLog() 305 output := c.GetTestLog()
306 c.Assert(output, gocheck.Matches, expected) 306 c.Assert(output, gocheck.Matches, expected)
307 } 307 }
308 308
309 // ----------------------------------------------------------------------- 309 // -----------------------------------------------------------------------
310 // Ensure that suites with embedded types are working fine, including the 310 // Ensure that suites with embedded types are working fine, including the
311 // the workaround for issue 906. 311 // the workaround for issue 906.
312 312
313 type EmbeddedInternalS struct { 313 type EmbeddedInternalS struct {
314 called bool 314 called bool
(...skipping 11 matching lines...) Expand all
326 326
327 func (s *EmbeddedInternalS) TestMethod(c *gocheck.C) { 327 func (s *EmbeddedInternalS) TestMethod(c *gocheck.C) {
328 c.Error("TestMethod() of the embedded type was called!?") 328 c.Error("TestMethod() of the embedded type was called!?")
329 } 329 }
330 330
331 func (s *EmbeddedS) TestMethod(c *gocheck.C) { 331 func (s *EmbeddedS) TestMethod(c *gocheck.C) {
332 // http://code.google.com/p/go/issues/detail?id=906 332 // http://code.google.com/p/go/issues/detail?id=906
333 c.Check(s.called, gocheck.Equals, false) // Go issue 906 is affecting th e runner? 333 c.Check(s.called, gocheck.Equals, false) // Go issue 906 is affecting th e runner?
334 s.called = true 334 s.called = true
335 } 335 }
LEFTRIGHT

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