[PATCH 1/2] Add test for incorrect threading of messages

2014-05-26 Thread Michal Sojka
This happens when there is some garbage after the last Message-ID in
the References header. See for example
https://lkml.org/lkml/headers/2014/5/19/864.
---
 test/T510-thread-replies.sh | 28 
 1 file changed, 28 insertions(+)

diff --git a/test/T510-thread-replies.sh b/test/T510-thread-replies.sh
index eeb70d0..d818b89 100755
--- a/test/T510-thread-replies.sh
+++ b/test/T510-thread-replies.sh
@@ -137,5 +137,33 @@ expected='[[[{"id": "foo at four.com", "match": true, 
"excluded": false,
 expected=`echo "$expected" | notmuch_json_show_sanitize`
 test_expect_equal_json "$output" "$expected"

+test_begin_subtest "Ignore garbage at the end of References"
+test_subtest_known_broken
+add_message '[id]="foo at five.com"' \
+'[subject]="five"'
+add_message '[id]="bar at five.com"' \
+'[references]=" (garbage)"' \
+'[subject]="not-five"'
+output=$(notmuch show --format=json 'subject:five' | 
notmuch_json_show_sanitize)
+expected='[[[{"id": "X", "match": true, "excluded": false,
+ "filename": "Y", "timestamp": 42, "date_relative": "2001-01-05",
+ "tags": ["inbox", "unread"], "headers": {"Subject": "five",
+ "From": "Notmuch Test Suite ",
+ "To": "Notmuch Test Suite ",
+ "Date": "GENERATED_DATE"}, "body": [{"id": 1,
+ "content-type": "text/plain",
+ "content": "This is just a test message (#10)\n"}]},
+ [[{"id": "X", "match": true, "excluded": false,
+ "filename": "Y", "timestamp": 42, "date_relative": "2001-01-05",
+ "tags": ["inbox", "unread"],
+ "headers": {"Subject": "not-five",
+ "From": "Notmuch Test Suite ",
+ "To": "Notmuch Test Suite ",
+ "Date": "GENERATED_DATE"},
+ "body": [{"id": 1, "content-type": "text/plain",
+ "content": "This is just a test message (#11)\n"}]}, []]'
+expected=`echo "$expected" | notmuch_json_show_sanitize`
+test_expect_equal_json "$output" "$expected"
+

 test_done
-- 
2.0.0.rc2



[PATCH 1/2] Add test for incorrect threading of messages

2014-05-26 Thread Michal Sojka
This happens when there is some garbage after the last Message-ID in
the References header. See for example
https://lkml.org/lkml/headers/2014/5/19/864.
---
 test/T510-thread-replies.sh | 28 
 1 file changed, 28 insertions(+)

diff --git a/test/T510-thread-replies.sh b/test/T510-thread-replies.sh
index eeb70d0..d818b89 100755
--- a/test/T510-thread-replies.sh
+++ b/test/T510-thread-replies.sh
@@ -137,5 +137,33 @@ expected='[[[{id: f...@four.com, match: true, 
excluded: false,
 expected=`echo $expected | notmuch_json_show_sanitize`
 test_expect_equal_json $output $expected
 
+test_begin_subtest Ignore garbage at the end of References
+test_subtest_known_broken
+add_message '[id]=f...@five.com' \
+'[subject]=five'
+add_message '[id]=b...@five.com' \
+'[references]=f...@five.com (garbage)' \
+'[subject]=not-five'
+output=$(notmuch show --format=json 'subject:five' | 
notmuch_json_show_sanitize)
+expected='[[[{id: X, match: true, excluded: false,
+ filename: Y, timestamp: 42, date_relative: 2001-01-05,
+ tags: [inbox, unread], headers: {Subject: five,
+ From: Notmuch Test Suite test_su...@notmuchmail.org,
+ To: Notmuch Test Suite test_su...@notmuchmail.org,
+ Date: GENERATED_DATE}, body: [{id: 1,
+ content-type: text/plain,
+ content: This is just a test message (#10)\n}]},
+ [[{id: X, match: true, excluded: false,
+ filename: Y, timestamp: 42, date_relative: 2001-01-05,
+ tags: [inbox, unread],
+ headers: {Subject: not-five,
+ From: Notmuch Test Suite test_su...@notmuchmail.org,
+ To: Notmuch Test Suite test_su...@notmuchmail.org,
+ Date: GENERATED_DATE},
+ body: [{id: 1, content-type: text/plain,
+ content: This is just a test message (#11)\n}]}, []]'
+expected=`echo $expected | notmuch_json_show_sanitize`
+test_expect_equal_json $output $expected
+
 
 test_done
-- 
2.0.0.rc2

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch