better error message for unit test

This commit is contained in:
Nan Deng 2014-07-08 13:22:30 -07:00
parent 18f531b5fb
commit a3d9f2d094

View File

@ -25,6 +25,7 @@ import (
"github.com/google/cadvisor/info" "github.com/google/cadvisor/info"
itest "github.com/google/cadvisor/info/test" itest "github.com/google/cadvisor/info/test"
"github.com/kr/pretty"
) )
func testGetJsonData( func testGetJsonData(
@ -36,7 +37,7 @@ func testGetJsonData(
return fmt.Errorf("unable to retrieve data: %v", err) return fmt.Errorf("unable to retrieve data: %v", err)
} }
if !reflect.DeepEqual(reply, expected) { if !reflect.DeepEqual(reply, expected) {
return fmt.Errorf("retrieved wrong data: %+v != %+v", reply, expected) return pretty.Errorf("retrieved wrong data: %# v != %# v", reply, expected)
} }
return nil return nil
} }