From 59ae05b797b6be0618bd953140eee8ca39bf4844 Mon Sep 17 00:00:00 2001 From: siddontang Date: Thu, 24 Sep 2015 10:57:48 +0800 Subject: [PATCH] tidb: add enum type test --- tidb_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tidb_test.go b/tidb_test.go index bebd9a66c5..0ae4c43e62 100644 --- a/tidb_test.go +++ b/tidb_test.go @@ -894,6 +894,24 @@ func (s *testSessionSuite) TestBootstrap(c *C) { mustExecSQL(c, se, "USE test;") } +func (s *testSessionSuite) TestEnum(c *C) { + store := newStore(c, s.dbName) + se := newSession(c, store, s.dbName) + + mustExecSQL(c, se, "drop table if exists t") + mustExecSQL(c, se, "create table t (c enum('a', 'b', 'c'))") + mustExecSQL(c, se, "insert into t values ('a'), (2), ('c')") + r := mustExecSQL(c, se, "select * from t where c = 'a'") + row, err := r.FirstRow() + c.Assert(err, IsNil) + match(c, row, "a") + + r = mustExecSQL(c, se, "select c + 1 from t where c = 2") + row, err = r.FirstRow() + c.Assert(err, IsNil) + match(c, row, "3") +} + func newSession(c *C, store kv.Storage, dbName string) Session { se, err := CreateSession(store) c.Assert(err, IsNil)