Skip to content

Commit

Permalink
use the same empty string comparison through out the code
Browse files Browse the repository at this point in the history
  • Loading branch information
pashagolub committed Oct 18, 2023
1 parent 1ff4542 commit 3c52e8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func (e *ExpectedExec) String() string {
msg += fmt.Sprintf("\t\t%d - %+v\n", i, arg)
}
}
if e.result.String() > "" {
if e.result.String() != "" {
msg += fmt.Sprintf("\t- returns result: %s\n", e.result)
}

Expand Down
4 changes: 2 additions & 2 deletions pgxmock.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ func (c *pgxmock) Query(ctx context.Context, sql string, args ...interface{}) (p
}
if rewrittenSQL, err := queryExp.argsMatches(sql, args); err != nil {
return err
} else if rewrittenSQL > "" {
} else if rewrittenSQL != "" {
if err := c.queryMatcher.Match(queryExp.expectRewrittenSQL, rewrittenSQL); err != nil {
return err
}
Expand Down Expand Up @@ -474,7 +474,7 @@ func (c *pgxmock) Exec(ctx context.Context, query string, args ...interface{}) (
}
if rewrittenSQL, err := execExp.argsMatches(query, args); err != nil {
return err
} else if rewrittenSQL > "" {
} else if rewrittenSQL != "" {
if err := c.queryMatcher.Match(execExp.expectRewrittenSQL, rewrittenSQL); err != nil {
//pgx support QueryRewriter for arguments, now we can check if the query was actually rewriten
return err
Expand Down

0 comments on commit 3c52e8d

Please sign in to comment.