Esempio n. 1
0
func myLog(c *check.C, args ...interface{}) {
	if len(args) == 1 {
		c.Log(fmt.Sprintf("%s: %v\n", c.TestName(), args[0]))
		return
	}
	newArgs := make([]interface{}, len(args)-1)
	for i, a := range args[1:] {
		switch a := a.(type) {
		default:
			j, err := json.Marshal(a)
			if err == nil {
				newArgs[i] = fmt.Sprintf("%T: %s", a, j)
			} else {
				newArgs[i] = fmt.Sprintf("%s", a)
			}
		case bool:
			newArgs[i] = a
		case int:
			newArgs[i] = a
		case uint:
			newArgs[i] = a
		case uint64:
			newArgs[i] = a
		case string:
			newArgs[i] = a
		}
	}
	fmtStr := fmt.Sprintf("%s: %s\n", c.TestName(), args[0].(string))
	c.Logf(fmtStr, newArgs...)
}
Esempio n. 2
0
func (s *TimerSuite) TearDownTest(c *check.C) {
	fmt.Printf("%-60s%.2f\n", c.TestName(), time.Since(s.start).Seconds())
}