Commit graph

17 commits

Author SHA1 Message Date
Michael Gratton
0ae633d88f Update existing tests to work with ValaUnit 2020-06-30 17:31:07 +10:00
Michael Gratton
6b1bad28b9 Move generic unit test classes to a new basically-standalone subproject
Break out the generic testing code into something easily re-used, and
improve the API substantially:

 * Use generics to reduce the number of equality tests to effectively
   a single one
 * Make all assert args consistent in that the actual value is always
   listed first.
 * Add convenience API for common string/array/collection assertions
2020-06-30 17:20:12 +10:00
Michael Gratton
196f05e595 test/test-case.vala: Rename TestCase async calls to match AsyncCallWaiter's 2020-04-10 12:58:09 +10:00
Michael Gratton
768f6afc78 test/test-case.vala: Add AsyncResultWaiter class
Add new class to allow testing interleaving of multiple async calls.
Re-implement TestCase's support for this using an internal instance
of the new class.
2020-04-10 12:39:56 +10:00
Michael Gratton
54156003b4 Add TestCase.assert_double 2020-03-27 08:29:14 +11:00
Michael Gratton
60a3f9346d Add TestCase.async_complete_full method to avoid requiring a lambda 2019-03-31 01:29:52 +11:00
Michael Gratton
9c115bec38 Clean up protocol date handling substantially
In RFC822.Date, don't use duplicate time_t and GLib.DateTime properties
-- just use the latter, fix formatting of half-hour time zones, fix
where the that class refers to ISO 8601 instead of RFC822 strings since
that is just plain wrong, and finally when parsing an RFC 822 string,
take note of the timezone offset and store that in the DateTime object,
so it is round-tripped correctly.

Stop passing time_t around everywhere else, just use the UNIX time from
the DateTimes we store for protocol objects anyway, so the time zone is
obvious.

Add unit tests.
2019-03-23 15:21:18 +11:00
Rico Tzschichholz
e09475e81d Constructors of abstract classes should not be public 2019-03-15 09:49:05 +11:00
Michael Gratton
4e484e237d Make TestCase.assert_string robust in the face of null actuals 2019-03-09 20:17:01 +11:00
Kristian Klausen
9ef6d7ccec Replace all tab indentation with 4 spaces
find . -name '*.vala' -type f -exec sed -i.orig 's/\t/    /g' {} +
and a few manual adjustment.

Fix #271
2019-02-27 19:19:58 +01:00
Michael Gratton
9619d18eda Ensure conversations that have no email in the base folder are dropped
If a least one email in a conversation that is in the base folder but
also in another is removed from the base folder, the conversation may
not be removed from the monitor despite possibly not having any email
in the base folder, since the email may not have been completely removed
from the conversation.

This was particulary being seen with GMail accounts where even single
message conversations were not disappering when trashed because the
converation's email was still in All Mail.

This fix does a few things: Avoids hitting the database when checking
a conversation still has email in the base folder, when it does check
only ensures that email are in the base folder, not *any* folder, and
updates ConversationSet::remove_all_emails_by_identifier to do this
check iternally, clean up its API and implementation and avoids having
to use out args calling it.
2019-02-16 16:26:10 +11:00
Michael Gratton
faf7a2bdfd Add some unit tests for Geary.ImapDb.Account folder management 2019-01-14 11:01:03 +11:00
Michael James Gratton
f78939ce00 Push GResource URL for test data down so it's accessible to all tests. 2018-05-19 09:26:09 +10:00
Michael James Gratton
587e4e7596 Add TestCase.assert_null_string method. 2018-05-08 12:25:03 +10:00
Michael James Gratton
598f1a5e89 Increase len of non-truncated strs that TestCase.assert_string reports. 2018-04-27 12:37:13 +10:00
Michael James Gratton
712088061b Add a mock object mixin that can check call expectations on mocks.
* test/mock-object.vala: Add initial mock object implementation.

* test/test-case.vala; Add some useful high level assertion functions.
2018-04-07 10:02:18 +10:00
Michael James Gratton
15748cef03 Tidy up unit test infrastructure and mock classes.
* test/api/*.vala: Renamed files that contained mock objects to *-mock.vala,
  not *-test.vala.

* test/testcase.vala: Renamed to test-case.vala for consistency, remove
  TestCase class from Gee package since that's really not true. Clean up
  code for consistency.

* test/meson.build, test/CMakeLists.txt: Split TestCase compilation out
  into a separate test lib.
2018-04-07 09:41:18 +10:00
Renamed from test/testcase.vala (Browse further)