forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add further testing to CountStar formatting
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
- Loading branch information
1 parent
ae6c966
commit 92cd529
Showing
4 changed files
with
65 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package sqlparser | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestCountStarFormatFast(t *testing.T) { | ||
{ | ||
buf := NewTrackedBuffer(nil) | ||
node := &CountStar{} | ||
node.formatFast(buf) | ||
assert.Equal(t, &ParsedQuery{Query: "count(*)"}, buf.ParsedQuery()) | ||
} | ||
{ | ||
buf := NewTrackedBuffer(nil) | ||
node := &CountStar{Name: "Count"} | ||
node.formatFast(buf) | ||
assert.Equal(t, &ParsedQuery{Query: "Count(*)"}, buf.ParsedQuery()) | ||
} | ||
{ | ||
buf := NewTrackedBuffer(nil) | ||
node := &CountStar{Name: "COUNT"} | ||
node.formatFast(buf) | ||
assert.Equal(t, &ParsedQuery{Query: "COUNT(*)"}, buf.ParsedQuery()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package sqlparser | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestCountStarFormat(t *testing.T) { | ||
{ | ||
buf := NewTrackedBuffer(nil) | ||
node := &CountStar{} | ||
node.Format(buf) | ||
assert.Equal(t, &ParsedQuery{Query: "count(*)"}, buf.ParsedQuery()) | ||
} | ||
{ | ||
buf := NewTrackedBuffer(nil) | ||
node := &CountStar{Name: "Count"} | ||
node.Format(buf) | ||
assert.Equal(t, &ParsedQuery{Query: "Count(*)"}, buf.ParsedQuery()) | ||
} | ||
{ | ||
buf := NewTrackedBuffer(nil) | ||
node := &CountStar{Name: "COUNT"} | ||
node.Format(buf) | ||
assert.Equal(t, &ParsedQuery{Query: "COUNT(*)"}, buf.ParsedQuery()) | ||
} | ||
} |