print the diff between the actual result and the expected result.

pull/17/head
John Shahid 2013-10-09 16:05:08 -04:00
parent 7eb5c02301
commit ffda730b03
1 changed files with 12 additions and 0 deletions

View File

@ -2,9 +2,12 @@ package engine
import (
"encoding/json"
"fmt"
. "launchpad.net/gocheck"
"os"
"parser"
"protocol"
"reflect"
"testing"
)
@ -69,6 +72,15 @@ func runQuery(engine EngineI, query string, c *C, expectedSeries string) {
series := stringToSeriesArray(expectedSeries, c)
if !reflect.DeepEqual(result, series) {
resultData, _ := json.MarshalIndent(result, "", " ")
seriesData, _ := json.MarshalIndent(series, "", " ")
fmt.Fprintf(os.Stderr,
"===============\nThe two series aren't equal.\nExpected: %s\nActual: %s\n===============\n",
seriesData, resultData)
}
c.Assert(result, DeepEquals, series)
}