From bd0e43c139be5608ab318e5893c1391c24163581 Mon Sep 17 00:00:00 2001 From: Sugu Sougoumarane Date: Tue, 4 Aug 2015 14:32:01 -0700 Subject: [PATCH] sqlparser: add tests to improve coverage --- data/test/sqlparser_test/parse_pass.sql | 4 +++- go/vt/sqlparser/ast_test.go | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/data/test/sqlparser_test/parse_pass.sql b/data/test/sqlparser_test/parse_pass.sql index b33883bfa2..2563126c42 100644 --- a/data/test/sqlparser_test/parse_pass.sql +++ b/data/test/sqlparser_test/parse_pass.sql @@ -82,7 +82,9 @@ select /* is not null */ 1 from t where a is not null select /* < */ 1 from t where a < b select /* <= */ 1 from t where a <= b select /* >= */ 1 from t where a >= b -select /* <> */ 1 from t where a != b +select /* > */ 1 from t where a > b +select /* != */ 1 from t where a != b +select /* <> */ 1 from t where a <> b#select /* <> */ 1 from t where a != b select /* <=> */ 1 from t where a <=> b select /* != */ 1 from t where a != b select /* single value expre list */ 1 from t where a in (b) diff --git a/go/vt/sqlparser/ast_test.go b/go/vt/sqlparser/ast_test.go index a0e776fd01..28af8dbf2e 100644 --- a/go/vt/sqlparser/ast_test.go +++ b/go/vt/sqlparser/ast_test.go @@ -94,3 +94,15 @@ func TestLimits(t *testing.T) { t.Errorf("got %v, want %s", err, wantErr) } } + +func TestIsAggregate(t *testing.T) { + f := FuncExpr{Name: "avg"} + if !f.IsAggregate() { + t.Error("IsAggregate: false, want true") + } + + f = FuncExpr{Name: "foo"} + if f.IsAggregate() { + t.Error("IsAggregate: true, want false") + } +}