forked from sqlitebrowser/sqlitebrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestRegex.cpp
More file actions
44 lines (36 loc) · 971 Bytes
/
TestRegex.cpp
File metadata and controls
44 lines (36 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "TestRegex.h"
#include "../sqlitedb.h"
#include "../sqlitetablemodel.h"
#include <QtTest/QTest>
QTEST_APPLESS_MAIN(TestRegex)
void TestRegex::sqlQueryComments_data()
{
QTest::addColumn<QString>("dirtyQuery");
QTest::addColumn<QString>("clearQuery");
QTest::newRow("test1")
<< // dirtyQuery
"SELECT * -- asd ffdsf\n"
"-- saf ewf sf\n"
"-- dsaf fd\n"
"FROM \t-- sfsdf\n"
"qwfwqf -- asdasd"
<< // clearQuery
"SELECT *\nFROM\nqwfwqf";
QTest::newRow("test2")
<< // dirtyQuery
"SELECT *-- comment\n"
"FROM\n\n"
"-- something\n"
"qwfqwf"
<< // cleanQuery
"SELECT *\nFROM\nqwfqwf";
}
void TestRegex::sqlQueryComments()
{
DBBrowserDB db;
SqliteTableModel model(db);
QFETCH(QString, dirtyQuery);
QFETCH(QString, clearQuery);
model.removeCommentsFromQuery(dirtyQuery);
QCOMPARE(dirtyQuery, clearQuery);
}