From 856a651d38a520b614d6147f01afccb0cc84fa23 Mon Sep 17 00:00:00 2001 From: Jakub Sitnicki Date: Tue, 15 Jul 2014 07:24:47 +0200 Subject: [PATCH] tests: threads: Test if grandchild message promotes only its subthread --- .../grandchild-promotes-only-subthread/cur/A | 7 +++++ .../grandchild-promotes-only-subthread/cur/B | 7 +++++ .../grandchild-promotes-only-subthread/cur/C | 9 ++++++ .../grandchild-promotes-only-subthread/cur/D | 9 ++++++ .../grandchild-promotes-only-subthread/cur/E | 9 ++++++ .../grandchild-promotes-only-subthread/cur/F | 9 ++++++ .../grandchild-promotes-only-subthread/cur/G | 7 +++++ .../new/.noindex | 0 .../tmp/.noindex | 0 mu/tests/test-mu-threads.c | 31 +++++++++++++++++++ 10 files changed, 88 insertions(+) create mode 100644 lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/A create mode 100644 lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/B create mode 100644 lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/C create mode 100644 lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/D create mode 100644 lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/E create mode 100644 lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/F create mode 100644 lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/G create mode 100644 lib/tests/testdir3/sort/grandchild-promotes-only-subthread/new/.noindex create mode 100644 lib/tests/testdir3/sort/grandchild-promotes-only-subthread/tmp/.noindex diff --git a/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/A b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/A new file mode 100644 index 00000000..85130e80 --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/A @@ -0,0 +1,7 @@ +From: testfrom@example.com +To: testto@example.com +Subject: A +Message-Id: +Date: Sat, 17 May 2014 10:00:00 +0000 + +A diff --git a/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/B b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/B new file mode 100644 index 00000000..254aeb72 --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/B @@ -0,0 +1,7 @@ +From: testfrom@example.com +To: testto@example.com +Subject: B +Message-Id: +Date: Sat, 17 May 2014 10:00:00 +0000 + +B diff --git a/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/C b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/C new file mode 100644 index 00000000..6d1e19af --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/C @@ -0,0 +1,9 @@ +From: testfrom@example.com +To: testto@example.com +Subject: C +Message-Id: +References: +In-reply-to: +Date: Sat, 17 May 2014 10:00:00 +0000 + +C diff --git a/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/D b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/D new file mode 100644 index 00000000..1e4861df --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/D @@ -0,0 +1,9 @@ +From: testfrom@example.com +To: testto@example.com +Subject: D +Message-Id: +References: +In-reply-to: +Date: Sat, 17 May 2014 10:00:00 +0000 + +D diff --git a/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/E b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/E new file mode 100644 index 00000000..bb7f5f39 --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/E @@ -0,0 +1,9 @@ +From: testfrom@example.com +To: testto@example.com +Subject: E +Message-Id: +References: +In-reply-to: +Date: Sat, 17 May 2014 10:00:00 +0000 + +E diff --git a/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/F b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/F new file mode 100644 index 00000000..7c4275d7 --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/F @@ -0,0 +1,9 @@ +From: testfrom@example.com +To: testto@example.com +Subject: F +Message-Id: +References: +In-reply-to: +Date: Sat, 17 May 2014 10:00:00 +0000 + +F diff --git a/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/G b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/G new file mode 100644 index 00000000..4849455f --- /dev/null +++ b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/cur/G @@ -0,0 +1,7 @@ +From: testfrom@example.com +To: testto@example.com +Subject: G +Message-Id: +Date: Sat, 17 May 2014 10:00:00 +0000 + +G diff --git a/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/new/.noindex b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/new/.noindex new file mode 100644 index 00000000..e69de29b diff --git a/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/tmp/.noindex b/lib/tests/testdir3/sort/grandchild-promotes-only-subthread/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 4e89d861..e11046fd 100644 --- a/mu/tests/test-mu-threads.c +++ b/mu/tests/test-mu-threads.c @@ -397,6 +397,35 @@ test_mu_threads_sort_grandchild_promotes_thread (void) G_N_ELEMENTS (expected_desc)); } +static void +test_mu_threads_sort_granchild_promotes_only_subthread (void) +{ + const char *query = "maildir:/sort/grandchild-promotes-only-subthread"; + + const tinfo expected_asc [] = { + { "0", "A@msg.id", "A"}, + { "1", "B@msg.id", "B"}, + { "1:0", "C@msg.id", "C"}, + { "1:1", "E@msg.id", "E"}, + { "1:2", "D@msg.id", "D"}, + { "1:2:0", "F@msg.id", "F"}, + { "2", "G@msg.id", "G"}, + }; + const tinfo expected_desc [] = { + { "0", "G@msg.id", "G"}, + { "1", "B@msg.id", "B"}, + { "1:0", "D@msg.id", "D"}, + { "1:0:0", "F@msg.id", "F"}, + { "1:1", "E@msg.id", "E"}, + { "1:2", "C@msg.id", "C"}, + { "2", "A@msg.id", "A"}, + }; + + 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[]) { @@ -416,6 +445,8 @@ main (int argc, char *argv[]) test_mu_threads_sort_child_does_not_promote_thread); g_test_add_func ("/mu-query/test-mu-threads-sort-grandchild-promotes-thread", test_mu_threads_sort_grandchild_promotes_thread); + g_test_add_func ("/mu-query/test-mu-threads-sort-grandchild-promotes-only-subthread", + test_mu_threads_sort_granchild_promotes_only_subthread); g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,