From b0357a2d7a1dd01d371b24dc6e1acc14828e1597 Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Tue, 15 Jul 2014 07:23:53 +0200 Subject: [PATCH] tests: threads: Test if child message doesn't promote its thread --- .../sort/child-does-not-promote-thread/cur/A | 9 +++++++ .../sort/child-does-not-promote-thread/cur/X | 7 +++++ .../sort/child-does-not-promote-thread/cur/Y | 7 +++++ .../sort/child-does-not-promote-thread/cur/Z | 7 +++++ .../new/.noindex | 0 .../tmp/.noindex | 0 mu/tests/test-mu-threads.c | 27 +++++++++++++++++++ 7 files changed, 57 insertions(+) create mode 100644 lib/tests/testdir3/sort/child-does-not-promote-thread/cur/A create mode 100644 lib/tests/testdir3/sort/child-does-not-promote-thread/cur/X create mode 100644 lib/tests/testdir3/sort/child-does-not-promote-thread/cur/Y create mode 100644 lib/tests/testdir3/sort/child-does-not-promote-thread/cur/Z create mode 100644 lib/tests/testdir3/sort/child-does-not-promote-thread/new/.noindex create mode 100644 lib/tests/testdir3/sort/child-does-not-promote-thread/tmp/.noindex diff --git a/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/A b/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/A new file mode 100644 index 00000000..c59c42fd --- /dev/null +++ b/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/A @@ -0,0 +1,9 @@ +From: testfrom@example.com +To: testto@example.com +Subject: A +Message-Id: +References: +In-reply-to: +Aate: Sat, 17 May 2014 10:00:00 +0000 + +A diff --git a/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/X b/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/X new file mode 100644 index 00000000..c8ac3aa2 --- /dev/null +++ b/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/X @@ -0,0 +1,7 @@ +From: testfrom@example.com +To: testto@example.com +Subject: X +Message-Id: +Date: Sat, 17 May 2014 10:00:00 +0000 + +X diff --git a/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/Y b/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/Y new file mode 100644 index 00000000..ceadc203 --- /dev/null +++ b/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/Y @@ -0,0 +1,7 @@ +From: testfrom@example.com +To: testto@example.com +Subject: Y +Message-Id: +Date: Sat, 17 May 2014 10:00:00 +0000 + +Y diff --git a/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/Z b/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/Z new file mode 100644 index 00000000..365775b8 --- /dev/null +++ b/lib/tests/testdir3/sort/child-does-not-promote-thread/cur/Z @@ -0,0 +1,7 @@ +From: testfrom@example.com +To: testto@example.com +Subject: Z +Message-Id: +Date: Sat, 17 May 2014 10:00:00 +0000 + +Z diff --git a/lib/tests/testdir3/sort/child-does-not-promote-thread/new/.noindex b/lib/tests/testdir3/sort/child-does-not-promote-thread/new/.noindex new file mode 100644 index 00000000..e69de29b diff --git a/lib/tests/testdir3/sort/child-does-not-promote-thread/tmp/.noindex b/lib/tests/testdir3/sort/child-does-not-promote-thread/tmp/.noindex new file mode 100644 index 00000000..e69de29b diff --git a/mu/tests/test-mu-threads.c b/mu/tests/test-mu-threads.c index f059e9a5..edfa1602 100644 --- a/mu/tests/test-mu-threads.c +++ b/mu/tests/test-mu-threads.c @@ -346,6 +346,31 @@ test_mu_threads_sort_orphan_promotes_thread (void) G_N_ELEMENTS (expected_desc)); } +/* Won't normally happen when sorting by date. */ +static void +test_mu_threads_sort_child_does_not_promote_thread (void) +{ + const char *query = "maildir:/sort/child-does-not-promote-thread"; + + const tinfo expected_asc [] = { + { "0", "X@msg.id", "X"}, + { "1", "Y@msg.id", "Y"}, + { "1:0", "A@msg.id", "A"}, + { "2", "Z@msg.id", "Z"}, + }; + const tinfo expected_desc [] = { + { "0", "Z@msg.id", "Z"}, + { "1", "Y@msg.id", "Y"}, + { "1:0", "A@msg.id", "A"}, + { "2", "X@msg.id", "X"}, + }; + + check_sort_by_subject_asc (query, expected_asc, + G_N_ELEMENTS (expected_asc)); + check_sort_by_subject_desc (query, expected_desc, + G_N_ELEMENTS (expected_desc)); +} + int main (int argc, char *argv[]) { @@ -361,6 +386,8 @@ main (int argc, char *argv[]) test_mu_threads_sort_2nd_child_promotes_thread); g_test_add_func ("/mu-query/test-mu-threads-orphan-promotes-thread", test_mu_threads_sort_orphan_promotes_thread); + g_test_add_func ("/mu-query/test-mu-threads-sort-child-does-not-promote-thread", + test_mu_threads_sort_child_does_not_promote_thread); g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,