This allows us to compile the engine tests against the internal VAPI, so we can unit test internal classes. * CMakeLists.txt: Add top-level targets test-engine-run and test-client-run that execute the respective test binaries. Make the tests target depend on them and make them depend on their binaries. * Makefile.in: Add test-client and test-engin targets for convenience. * src/CMakeLists.txt: Make the right invocation of valac to generate a correct geary-engine-internal.vapi. Make gsettings schema generation depend on geary-client so it exists for test-client if the main binary hasn't been built. * test/CMakeLists.txt: Split everything up into to builds, one for test-engine and the other for test-client. Use geary-engine-internal when building test-engine for access to internal classes and members. * test/engine/util-idle-manager-test.vala, test/engine/util-timeout-manager-test.vala: Use Glib MainContext rather than the GTK main loop for pumping events so the test cases compile without GTK. * test/test-engine.vala, test/test-client.vala: New main source file for test binaries based on old main.vala.
58 lines
1.7 KiB
Vala
58 lines
1.7 KiB
Vala
/*
|
|
* Copyright 2016-2017 Michael Gratton <mike@vee.net>
|
|
*
|
|
* This software is licensed under the GNU Lesser General Public License
|
|
* (version 2.1 or later). See the COPYING file in this distribution.
|
|
*/
|
|
|
|
int main(string[] args) {
|
|
/*
|
|
* Initialise all the things.
|
|
*/
|
|
|
|
Test.init(ref args);
|
|
|
|
Geary.RFC822.init();
|
|
Geary.HTML.init();
|
|
Geary.Logging.init();
|
|
|
|
/*
|
|
* Hook up all tests into appropriate suites
|
|
*/
|
|
|
|
TestSuite engine = new TestSuite("engine");
|
|
|
|
engine.add_suite(new Geary.AttachmentTest().get_suite());
|
|
engine.add_suite(new Geary.EngineTest().get_suite());
|
|
engine.add_suite(new Geary.HTML.UtilTest().get_suite());
|
|
engine.add_suite(new Geary.IdleManagerTest().get_suite());
|
|
engine.add_suite(new Geary.Imap.DeserializerTest().get_suite());
|
|
engine.add_suite(new Geary.Imap.CreateCommandTest().get_suite());
|
|
engine.add_suite(new Geary.Imap.NamespaceResponseTest().get_suite());
|
|
engine.add_suite(new Geary.Inet.Test().get_suite());
|
|
engine.add_suite(new Geary.JS.Test().get_suite());
|
|
engine.add_suite(new Geary.Mime.ContentTypeTest().get_suite());
|
|
engine.add_suite(new Geary.RFC822.MailboxAddressTest().get_suite());
|
|
engine.add_suite(new Geary.RFC822.MessageTest().get_suite());
|
|
engine.add_suite(new Geary.RFC822.MessageDataTest().get_suite());
|
|
engine.add_suite(new Geary.RFC822.Utils.Test().get_suite());
|
|
engine.add_suite(new Geary.TimeoutManagerTest().get_suite());
|
|
|
|
/*
|
|
* Run the tests
|
|
*/
|
|
TestSuite root = TestSuite.get_root();
|
|
root.add_suite(engine);
|
|
|
|
MainLoop loop = new MainLoop ();
|
|
|
|
int ret = -1;
|
|
Idle.add(() => {
|
|
ret = Test.run();
|
|
loop.quit();
|
|
return false;
|
|
});
|
|
|
|
loop.run();
|
|
return ret;
|
|
}
|