implement test for failing grammar in sql_grammar_test.cpp
This commit is contained in:
parent
5041dccf70
commit
043e34b70c
|
@ -36,4 +36,11 @@ PREPARE prep_inst: INSERT INTO test VALUES (?, ?, ?);
|
|||
PREPARE prep2 { INSERT INTO test VALUES (?, 0, 0); INSERT INTO test VALUES (0, ?, 0); INSERT INTO test VALUES (0, 0, ?); };
|
||||
EXECUTE prep_inst(1, 2, 3);
|
||||
EXECUTE prep;
|
||||
DEALLOCATE PREPARE prep;
|
||||
DEALLOCATE PREPARE prep;
|
||||
# Error expeced
|
||||
!
|
||||
!1
|
||||
!gibberish;
|
||||
!SELECT abc;
|
||||
!CREATE TABLE "table" FROM TBL FILE 'students.tbl';SELECT 1
|
||||
!CREATE TABLE "table" FROM TBL FILE 'students.tbl';1
|
|
@ -36,14 +36,14 @@ int main(int argc, char *argv[]) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool expectFalse = false;
|
||||
bool globalExpectFalse = false;
|
||||
bool useFile = false;
|
||||
std::string filePath = "";
|
||||
|
||||
// Parse command line arguments
|
||||
int i = 1;
|
||||
for (; i < argc; ++i) {
|
||||
if (STREQ(argv[i], "--false")) expectFalse = true;
|
||||
if (STREQ(argv[i], "--false")) globalExpectFalse = true;
|
||||
else if (STREQ(argv[i], "-f")) {
|
||||
useFile = true;
|
||||
filePath = argv[++i];
|
||||
|
@ -65,6 +65,12 @@ int main(int argc, char *argv[]) {
|
|||
// Execute queries
|
||||
int numFailed = 0;
|
||||
for (std::string sql : queries) {
|
||||
bool expectFalse = globalExpectFalse;
|
||||
if (sql.at(0) == '!') {
|
||||
expectFalse = !expectFalse;
|
||||
sql = sql.substr(1);
|
||||
}
|
||||
|
||||
// Measuring the parsing time
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
|
Loading…
Reference in New Issue