Commit Graph

84 Commits

Author SHA1 Message Date
Pino Toscano afaf2ca73c tests: fix QCoreApplication parameters
The argument count (first parameter) is a reference, and thus must be
kept alive for the whole lifetime of the QCoreApplication instance,
as also the Qt apidocs say.

Also properly create a "string array" for the actual args, instead
of badly casting a string to that.

This fixes sporadic crashes in this test.
2015-01-17 13:06:22 +01:00
Martin Kleusberg a090875575 tests: Add test for grammar fix in 1ea67c33d2 2015-01-06 14:12:08 +01:00
Martin Kleusberg 4b7766a0fe tests: Add tests for foreign key parsing 2014-11-06 18:29:34 +01:00
Martin Kleusberg 19baeb2a7a grammar: Fix double quote characters as used for escaping one
SQL allows you to use two quote characters instead of just one in order
to escape them. Example: ['aa''bb'] is read as [aa'bb]. Add detection
for these doubled quote characters to our grammar parser.

See issue #128.
2014-10-15 19:29:19 +02:00
Martin Kleusberg b841025bae tests: Add test to check escaping quotes by using two of them 2014-10-15 12:57:37 +02:00
Peinthor Rene 0031c0723f tests: fix tests to run without x server 2014-09-18 08:05:45 +02:00
Peinthor Rene 98ab683662 tests: fix tests to run without x server 2014-09-18 08:01:04 +02:00
Peinthor Rene 97e2025cc9 cvsparser: Newly implemented CSV Parser
Moved parser into it's own class
This parser now proper supports new lines in quoted text
and returns a QVector<QStringList> result.
2014-09-02 18:05:04 +02:00
Martin Kleusberg 03879d93f0 ImportCsvDialog: Allow other file encoding than UTF-8
Add a combobox and a text field for choosing a different encoding of the
input file than the default UTF-8.
2014-08-31 13:10:25 +02:00
Sandro Mani 27b6bef37d Fix bad test 2014-08-27 19:04:38 +02:00
Sandro Mani 6b4d079e6a Fix syntax issues 2014-08-27 19:04:35 +02:00
Martin Kleusberg ba75bd16fe Use common format for all include guards and avoid leading underscores
Use a common format for all include guards, make sure each header file
has one and make sure it's named after the file name.

And as a random extra in this commit: Make sure the gen_version.h file
generated by cmake ends with a line break.

Closes #59.
2014-07-31 21:32:58 +02:00
Martin Kleusberg 42a2faf411 Tests: Simplify the cmake file
Now that the dependeny to the main window is removed from the
DBBrowserDB class we can get rid of all the dialogs and widget related
stuff in the cmake file used for the unit test project. Because our
Application class depends on the main window, too, the code for the CSV
tests is changed to use Qt's standard QApplication class.
2014-07-12 16:21:08 +02:00
Martin Kleusberg e7924f3739 Tests: Add unit tests for CSV import
Add a new test class for testing the import functionality. Currently
it's only covers some test cases for the CSV import.

Since the function to test here (DBBrowserDB::decodeCSV) is part of the
DBBrowserDB class, that class has a reference to the main window and the
main window basically depends on the entire rest of the project the
makefile grew quite a bit unfortunately.
2014-07-11 21:31:34 +02:00
Martin Kleusberg ceb74a8cd4 Tests: Make sure the TestTable::parseSQLdefaultexpr() passes
Fix some issues in the parseSQLdefaultexpr unit test to make it actuall
pass.
2014-07-10 21:38:35 +02:00
Peinthor Rene 0df6148afe unittest: add test for literalvalue in default constraint 2014-07-10 07:30:25 +02:00
Peinthor Rene f2658958ce unittest: add a check for not exists 2014-07-05 15:16:16 +02:00
Peinthor Rene e1ea78fdda grammar: add tests for like operator and between 2014-06-25 19:20:58 +02:00
Martin Kleusberg 3da0d36463 Tests: Make sure all unit tests pass
Two unit tests where failing because of missing spaces in the expected
result string.
2014-06-20 12:51:56 +02:00
Martin Kleusberg 980f42d200 Tests: Add unit test for CHECK NOT LIKE constraint
Add a unit test for the grammar fix in
9cb0614ecf.
2014-06-20 12:50:30 +02:00
Peinthor Rene f246ddde1e correctly extract check expression from AST 2014-06-11 22:48:51 +02:00
Peinthor Rene 55d8c9f9d8 add a test with create table with IN 2014-06-11 22:48:51 +02:00
Martin Kleusberg 1f8686d1d4 Add tests for the new 'without rowid' parsing
Add tests for the 'without rowid' parsing in our SQL grammar added in
commit 3761acfd02.
2014-05-09 14:49:32 +02:00
Peinthor Rene 192ee9c0a8 add unittest for non ascii characters 2014-02-12 19:15:27 +01:00
Peinthor Rene 9214cfbc21 add a unittest for the keyword in column name issue 2013-11-24 10:26:32 +01:00
Martin Kleusberg b924859392 Tests: Add test for ed04128a74
Add a test for table and column names in single quotes for which support
was added in ed04128a74.
2013-07-18 20:45:27 +02:00
Peinthor Rene 1bef2501c0 tests: make this statement work in sqlite3 2013-07-18 15:42:33 +02:00
Peinthor Rene 26bb0e1adf split unittest class into header and cpp file 2013-07-11 16:12:45 +02:00
Martin Kleusberg 63cf871017 SqliteTypes: Move PK flag from table to field
Store the primary key flag(s) inside the sqlb::Field objects instead of
the sqlb::Table object. Technically this doesn't make a lot of sense but
then again it makes things a lot easier for us. So this should fix quite
a few issues in the entire program, especially - again - in
renameColumn(). It also magically fixes createColumn() which had no
chance of guessing which column should be a PK prior to this.

To benefit from these changes the EditTableDialog has changes as well.
- It should now be possible to set and unset PK and AI flags and they
  are actually saved.
- Setting the AI flag automatically sets the data type to Integer
  because that's the only type SQLite can handle in an autoincrement
  field.
- Clicking on the entry in the data type combobox which is currently
  selected doesn't update the DB anymore.

This commit also makes some changes to the unit tests to reflect the API
changes made. But it also adds missing quote characters in some
verification strings.

I hope this is a worthy 500th commit - at least it's got a long commit
message...
2013-06-03 20:15:29 +02:00
Peinthor Rene a95d33e5ee add unittest for foreign key parser problem 2013-05-03 21:12:56 +02:00
Peinthor Rene f4187521ee improve the unittests for create table parsing 2013-03-22 15:50:26 +01:00
Peinthor Rene 1b0d5a2ff9 Fix view updating after remove field in edittable dialog
rename the FieldList typedef to FieldVector
use a object instead of a table pointer in edittable dialog
2013-03-19 17:18:52 +01:00
Peinthor Rene 5737925079 Add a sqlite3 antlr2 "create table" grammar + generated parser files
There is also a "create table" ast walker which fills
info for the new sqlitetype objects.
A dependency to the antlr2 runtime was added.
The grammar most probably still contain bugs.
Why all this?
First writing grammars is fun and this is the only way
we can get all information for proper table editing + some time
in the future when the grammar is finished we can provide real
auto completion.
2013-03-16 20:18:57 +01:00
Peinthor Rene 9394caffa9 add classes for a new sqlite field and table objects
plus a unittest build mode
2013-02-28 17:15:03 +01:00