tests: Add test for grammar fix in 1ea67c33d2

This commit is contained in:
Martin Kleusberg
2015-01-06 14:12:08 +01:00
parent 1ea67c33d2
commit a090875575
2 changed files with 13 additions and 0 deletions

View File

@@ -252,6 +252,18 @@ void TestTable::parseSQLForeignKeys()
QCOMPARE(tab.fields().at(1)->foreignKey(), QString("w ( z ) on delete set null"));
}
void TestTable::parseSQLCheckConstraint()
{
QString sql = "CREATE TABLE a (`b` text CHECK(`b`='A' or `b`='B'));";
Table tab = Table::parseSQL(sql).first;
QCOMPARE(tab.name(), QString("a"));
QCOMPARE(tab.fields().at(0)->name(), QString("b"));
QCOMPARE(tab.fields().at(0)->type(), QString("text"));
QCOMPARE(tab.fields().at(0)->check(), QString("`b` = 'A' or `b` = 'B'"));
}
void TestTable::createTableWithIn()
{
QString sSQL = "CREATE TABLE not_working("

View File

@@ -23,6 +23,7 @@ private slots:
void parseNonASCIIChars();
void parseSQLEscapedQuotes();
void parseSQLForeignKeys();
void parseSQLCheckConstraint();
void createTableWithIn();
void createTableWithNotLikeConstraint();
};