[geary/mjog/mail-merge-plugin: 71/74] MailMerge: Break test source file into separate driver and test files
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/mail-merge-plugin: 71/74] MailMerge: Break test source file into separate driver and test files
- Date: Fri, 14 Aug 2020 02:09:05 +0000 (UTC)
commit 803302cc8a61de72763911ece9d442ef4c58a193
Author: Michael Gratton <mike vee net>
Date: Thu Aug 6 12:00:10 2020 +1000
MailMerge: Break test source file into separate driver and test files
Allow adding additional, unrelated unit tests.
...{util-test.vala => mail-merge-test-reader.vala} | 27 ++----------------
src/client/plugin/mail-merge/mail-merge-test.vala | 32 ++++++++++++++++++++++
src/client/plugin/mail-merge/meson.build | 3 +-
3 files changed, 37 insertions(+), 25 deletions(-)
---
diff --git a/src/client/plugin/mail-merge/util-test.vala
b/src/client/plugin/mail-merge/mail-merge-test-reader.vala
similarity index 91%
rename from src/client/plugin/mail-merge/util-test.vala
rename to src/client/plugin/mail-merge/mail-merge-test-reader.vala
index 5be404ffc..1d8f8e405 100644
--- a/src/client/plugin/mail-merge/util-test.vala
+++ b/src/client/plugin/mail-merge/mail-merge-test-reader.vala
@@ -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;
-}
diff --git a/src/client/plugin/mail-merge/mail-merge-test.vala
b/src/client/plugin/mail-merge/mail-merge-test.vala
new file mode 100644
index 000000000..ad0348df0
--- /dev/null
+++ b/src/client/plugin/mail-merge/mail-merge-test.vala
@@ -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;
+}
diff --git a/src/client/plugin/mail-merge/meson.build b/src/client/plugin/mail-merge/meson.build
index e912a59aa..7f637158e 100644
--- a/src/client/plugin/mail-merge/meson.build
+++ b/src/client/plugin/mail-merge/meson.build
@@ -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(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]