Skip to content

Commit d49d7e8

Browse files
committed
modify: 00055 rule unit test
1 parent 044597c commit d49d7e8

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

sqle/driver/mysql/rule_00055_test.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestRuleSQLE00055(t *testing.T) {
3939
INDEX idx_2 (a),
4040
PRIMARY KEY (id)
4141
);
42-
`, newTestResult().addResult(ruleName, "[id]", "[id]"))
42+
`, newTestResult().addResult(ruleName, "[[id]]", "Primary Key", "[idx_1]"))
4343

4444
//create table, with index, with no redundant index
4545
runSingleRuleInspectCase(rule, t, "create table, with index, with no redundant index", DefaultMysqlInspect(), `
@@ -61,7 +61,7 @@ func TestRuleSQLE00055(t *testing.T) {
6161
INDEX idx_1 (id,v1,v2),
6262
PRIMARY KEY (id, v1)
6363
);
64-
`, newTestResult().addResult(ruleName, "[id v1 v2]", "[id v1]"))
64+
`, newTestResult().addResult(ruleName, "[[id v1]]", "Primary Key", "[idx_1]"))
6565

6666
//create table, with index, with repeat index
6767
runSingleRuleInspectCase(rule, t, "create table, with index, with repeat index", DefaultMysqlInspect(), `
@@ -72,7 +72,7 @@ func TestRuleSQLE00055(t *testing.T) {
7272
PRIMARY KEY (id),
7373
INDEX idx_2 (id)
7474
)ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT="unit test";
75-
`, newTestResult().addResult(ruleName, "[id]", "[id]"))
75+
`, newTestResult().addResult(ruleName, "[[id]]", "Primary Key", "[idx_2]"))
7676

7777
//create index, with no redundant index
7878
runSingleRuleInspectCase(rule, t, "create index, with no redundant index", DefaultMysqlInspect(), `
@@ -82,12 +82,12 @@ func TestRuleSQLE00055(t *testing.T) {
8282
//create index, with redundant index
8383
runSingleRuleInspectCase(rule, t, "create index, with column, with redundant index", DefaultMysqlInspect(), `
8484
CREATE INDEX idx_2 on exist_db.exist_tb_9(v1, v2(10));
85-
`, newTestResult().addResult(ruleName, "[v1 v2 v3 v4]", "[v1 v2]"))
85+
`, newTestResult().addResult(ruleName, "[[v1 v2 v3 v4]]", "idx_1", "[idx_2]"))
8686

8787
//create index, with repeat index
8888
runSingleRuleInspectCase(rule, t, "create index, with repeat index", DefaultMysqlInspect(), `
8989
CREATE INDEX idx_2 on exist_db.exist_tb_9(v1,v2,v3, v4);
90-
`, newTestResult().addResult(ruleName, "[v1 v2 v3 v4]", "[v1 v2 v3 v4]"))
90+
`, newTestResult().addResult(ruleName, "[[v1 v2 v3 v4]]", "idx_1", "[idx_2]"))
9191

9292
//alter table, no index
9393
runSingleRuleInspectCase(rule, t, "alter table, no index", DefaultMysqlInspect(), `
@@ -104,14 +104,7 @@ ADD INDEX idx_3 (v4);
104104
runSingleRuleInspectCase(rule, t, "alter table, add index, with redundant index", DefaultMysqlInspect(), `
105105
ALTER TABLE exist_db.exist_tb_9
106106
ADD INDEX idx_3 (v1);
107-
`, newTestResult().addResult(ruleName, "[v1 v2 v3 v4]", "[v1]"))
108-
109-
// Alter table, add index, with repeat index
110-
runSingleRuleInspectCase(rule, t, "alter table, add index, with repeat index", DefaultMysqlInspect(), `
111-
ALTER TABLE exist_db.exist_tb_9
112-
ADD INDEX idx_2 (v2,v3),
113-
ADD INDEX idx_3 (v3);
114-
`, newTestResult().addResult(ruleName, "[v2 v3]", "[v2 v3]").addResult(ruleName, "[v3]", "[v3]"))
107+
`, newTestResult().addResult(ruleName, "[[v1 v2 v3 v4]]", "idx_1", "[idx_3]"))
115108

116109
// Alter table, drop index, no effect on redundancy
117110
runSingleRuleInspectCase(rule, t, "alter table, drop index, no effect on redundancy", DefaultMysqlInspect(), `

0 commit comments

Comments
 (0)