MailMerge: Break test source file into separate driver and test files
Allow adding additional, unrelated unit tests.
This commit is contained in:
parent
a6acf96d59
commit
b1807df1be
3 changed files with 37 additions and 25 deletions
|
|
@ -5,11 +5,11 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
public class ReaderTests : ValaUnit.TestCase {
|
||||
public class Plugin.MailMergeTestReader : ValaUnit.TestCase {
|
||||
|
||||
|
||||
public ReaderTests() {
|
||||
base("ReaderTests");
|
||||
public MailMergeTestReader() {
|
||||
base("MailMergeTestReader");
|
||||
add_test("read_simple_lf", read_simple_lf);
|
||||
add_test("read_simple_crlf", read_simple_crlf);
|
||||
add_test("read_no_trailing_new_line", read_no_trailing_new_line);
|
||||
|
|
@ -158,24 +158,3 @@ bar",""""""";
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(string[] args) {
|
||||
Test.init(ref args);
|
||||
|
||||
typeof(ReaderTests).name();
|
||||
|
||||
TestSuite root = TestSuite.get_root();
|
||||
root.add_suite(new ReaderTests().suite);
|
||||
|
||||
MainLoop loop = new MainLoop();
|
||||
int ret = -1;
|
||||
Idle.add(() => {
|
||||
ret = Test.run();
|
||||
loop.quit();
|
||||
return false;
|
||||
});
|
||||
|
||||
loop.run();
|
||||
return ret;
|
||||
}
|
||||
32
src/client/plugin/mail-merge/mail-merge-test.vala
Normal file
32
src/client/plugin/mail-merge/mail-merge-test.vala
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright © 2020 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) {
|
||||
GLib.Test.init(ref args);
|
||||
Geary.RFC822.init();
|
||||
Geary.HTML.init();
|
||||
Geary.Logging.init();
|
||||
if (GLib.Test.verbose()) {
|
||||
GLib.Log.set_writer_func(Geary.Logging.default_log_writer);
|
||||
Geary.Logging.log_to(GLib.stdout);
|
||||
}
|
||||
|
||||
GLib.TestSuite root = GLib.TestSuite.get_root();
|
||||
root.add_suite(new Plugin.MailMergeTestReader().suite);
|
||||
|
||||
GLib.MainLoop loop = new GLib.MainLoop();
|
||||
int ret = -1;
|
||||
GLib.Idle.add(() => {
|
||||
ret = Test.run();
|
||||
loop.quit();
|
||||
return false;
|
||||
});
|
||||
|
||||
loop.run();
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -14,7 +14,8 @@ lib_src = files(
|
|||
)
|
||||
|
||||
test_src = files(
|
||||
'util-test.vala'
|
||||
'mail-merge-test-reader.vala',
|
||||
'mail-merge-test.vala'
|
||||
)
|
||||
|
||||
lib = static_library(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue