Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pingcap/tidb into put_ser…
Browse files Browse the repository at this point in the history
…ver_info_to_pd
  • Loading branch information
crazycs520 committed Aug 15, 2018
2 parents f8b7b98 + f18176f commit 9831a1f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion executor/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
))
Expand Down
13 changes: 10 additions & 3 deletions util/testkit/testkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package testkit

import (
"bytes"
"fmt"
"sort"
"sync/atomic"
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 9831a1f

Please sign in to comment.