Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
tangenta committed Jul 11, 2019
1 parent 0a2bb9a commit 99bac73
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions ddl/db_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -770,18 +770,32 @@ func (s *testIntegrationSuite4) TestChangingTableCharset(c *C) {

}

func (s *testIntegrationSuite5) TestChangingColumnCollation(c *C) {
func (s *testIntegrationSuite5) TestModifyingColumnOption(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("create database if not exists test")
tk.MustExec("use test")

errCodeStr1 := "[ddl:210]" // unsupported modify collate from utf8mb4_bin to utf8mb4_general_ci"
errCodeStr2 := "[ddl:203]" // unsupported modify column with references
assertErrCode := func(sql string, errCodeStr string) {
_, err := tk.Exec(sql)
c.Assert(err, NotNil)
c.Assert(err.Error()[:len(errCodeStr)], Equals, errCodeStr)
}

tk.MustExec("drop table if exists t1")
tk.MustExec("create table t1 (b char(1) default null) engine=InnoDB default charset=utf8mb4 collate=utf8mb4_general_ci")
tk.MustExec("alter table t1 modify column b char(1) character set utf8mb4 collate utf8mb4_general_ci")
assertErrCode("alter table t1 modify column b char(1) character set utf8mb4 collate utf8mb4_general_ci", errCodeStr1)

tk.MustExec("drop table t1")
tk.MustExec("create table t1 (b char(1) collate utf8mb4_general_ci)")
tk.MustExec("alter table t1 modify b char(1) character set utf8mb4 collate utf8mb4_general_ci")

tk.MustExec("drop table t1")
tk.MustExec("drop table if exists t2")
tk.MustExec("create table t1 (a int)")
tk.MustExec("create table t2 (b int, c int)")
assertErrCode("alter table t2 modify column c int references t1(a)", errCodeStr2)
}

func (s *testIntegrationSuite2) TestCaseInsensitiveCharsetAndCollate(c *C) {
Expand Down

0 comments on commit 99bac73

Please sign in to comment.