提交 15efc627 authored 作者: Thomas Mueller's avatar Thomas Mueller

Fix test case.

上级 12239f89
......@@ -93,7 +93,7 @@ public class TestIndex extends TestBase {
private void testErrorMessage() throws SQLException {
reconnect();
stat.execute("create table test(id int primary key, name varchar)");
testErrorMessage("PRIMARY KEY ON PUBLIC.TEST(ID)");
testErrorMessage("PRIMARY", "KEY", " ON PUBLIC.TEST(ID)");
stat.execute("create table test(id int, name varchar primary key)");
testErrorMessage("PRIMARY_KEY_2 ON PUBLIC.TEST(NAME)");
stat.execute("create table test(id int, name varchar, primary key(id, name))");
......@@ -101,14 +101,14 @@ public class TestIndex extends TestBase {
stat.execute("create table test(id int, name varchar, primary key(name, id))");
testErrorMessage("PRIMARY_KEY_2 ON PUBLIC.TEST(NAME, ID)");
stat.execute("create table test(id int, name int primary key)");
testErrorMessage("PRIMARY KEY ON PUBLIC.TEST(NAME)");
testErrorMessage("PRIMARY", "KEY", " ON PUBLIC.TEST(NAME)");
stat.execute("create table test(id int, name int, unique(name))");
testErrorMessage("CONSTRAINT_INDEX_2 ON PUBLIC.TEST(NAME)");
stat.execute("create table test(id int, name int, constraint abc unique(name, id))");
testErrorMessage("ABC_INDEX_2 ON PUBLIC.TEST(NAME, ID)");
}
private void testErrorMessage(String expected) throws SQLException {
private void testErrorMessage(String... expected) throws SQLException {
try {
stat.execute("INSERT INTO TEST VALUES(1, 1)");
stat.execute("INSERT INTO TEST VALUES(1, 1)");
......@@ -117,7 +117,9 @@ public class TestIndex extends TestBase {
String m = e.getMessage();
int start = m.indexOf('\"'), end = m.indexOf('\"', start + 1);
String s = m.substring(start + 1, end);
assertEquals(expected, s);
for (String t : expected) {
assertTrue(t + " not in " + s, s.indexOf(t) >= 0);
}
}
stat.execute("drop table test");
}
......
......@@ -520,4 +520,5 @@ public class TestNestedJoins extends TestBase {
}
return sql;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论