diff --git a/executor/simple_test.go b/executor/simple_test.go index 2485f3c02f903..bc2b9d505d091 100644 --- a/executor/simple_test.go +++ b/executor/simple_test.go @@ -179,7 +179,8 @@ func (s *testSuite) TestUser(c *C) { tk.MustExec(dropUserSQL) tk.MustQuery("select * from mysql.db").Check(testkit.Rows( "localhost test testDB Y Y Y Y Y Y Y N Y Y N N N N N N Y N N", - "localhost test testDB1 Y Y Y Y Y Y Y N Y Y N N N N N N Y N N] [% dddb_% dduser Y Y Y Y Y Y Y N Y Y N N N N N N Y N N", + "localhost test testDB1 Y Y Y Y Y Y Y N Y Y N N N N N N Y N N", + "% dddb_% dduser Y Y Y Y Y Y Y N Y Y N N N N N N Y N N", "% test test Y N N N N N N N N N N N N N N N N N N", "localhost test testDBRevoke N N N N N N N N N N N N N N N N N N N", )) diff --git a/util/testkit/testkit.go b/util/testkit/testkit.go index 29523b57b0666..4da9712f20860 100644 --- a/util/testkit/testkit.go +++ b/util/testkit/testkit.go @@ -14,6 +14,7 @@ package testkit import ( + "bytes" "fmt" "sort" "sync/atomic" @@ -43,9 +44,15 @@ type Result struct { // Check asserts the result equals the expected results. func (res *Result) Check(expected [][]interface{}) { - got := fmt.Sprintf("%s", res.rows) - need := fmt.Sprintf("%s", expected) - res.c.Assert(got, check.Equals, need, res.comment) + resBuff := bytes.NewBufferString("") + for _, row := range res.rows { + fmt.Fprintf(resBuff, "%s\n", row) + } + needBuff := bytes.NewBufferString("") + for _, row := range expected { + fmt.Fprintf(needBuff, "%s\n", row) + } + res.c.Assert(resBuff.String(), check.Equals, needBuff.String(), res.comment) } // CheckAt asserts the result of selected columns equals the expected results.