[PATCH v2 7½/9] test: add notmuch address --deduplicate=(no|mailbox|address) tests

Jani Nikula jani at nikula.org
Fri Sep 25 10:08:09 PDT 2015


First a simple smoke test first, next generate messages with multiple
email address variants and check the behaviour of deduplication
schemes with these.

---

v2: more variation in name parts of email addresses
---
 test/T095-address.sh | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/test/T095-address.sh b/test/T095-address.sh
index f8d902cb3a5e..a194faf3b842 100755
--- a/test/T095-address.sh
+++ b/test/T095-address.sh
@@ -215,4 +215,78 @@ notmuch at notmuchmail.org
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
+test_begin_subtest "--deduplicate=address --output=sender --output=recipients"
+notmuch address --deduplicate=address --output=sender --output=recipients '*' | sort >OUTPUT
+cat <<EOF >EXPECTED
+"Discussion about the Arch User Repository (AUR)" <aur-general at archlinux.org>
+Adrian Perez de Castro <aperez at igalia.com>
+Alexander Botero-Lowry <alex.boterolowry at gmail.com>
+Allan McRae <allan at archlinux.org>
+Aron Griffis <agriffis at n01se.net>
+Carl Worth <cworth at cworth.org>
+Chris Wilson <chris at chris-wilson.co.uk>
+François Boulogne <boulogne.f at gmail.com>
+Ingmar Vanhassel <ingmar at exherbo.org>
+Israel Herraiz <isra at herraiz.org>
+Jan Janak <jan at ryngle.com>
+Jjgod Jiang <gzjjgod at gmail.com>
+Keith Packard <keithp at keithp.com>
+Lars Kellogg-Stedman <lars at seas.harvard.edu>
+Mikhail Gusarov <dottedmag at dottedmag.net>
+Olivier Berger <olivier.berger at it-sudparis.eu>
+Rolland Santimano <rollandsantimano at yahoo.com>
+Stewart Smith <stewart at flamingspork.com>
+notmuch at notmuchmail.org
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+generate_message '[from]="Foo Bar <foo.bar at example.com>"'
+generate_message '[from]="Foo Bar <Foo.Bar at Example.Com>"'
+generate_message '[from]="Foo Bar <foo.bar at example.com>"'
+generate_message '[from]="Bar <Foo.Bar at Example.Com>"'
+generate_message '[from]="Foo <foo.bar at example.com>"'
+generate_message '[from]="<foo.bar at example.com>"'
+generate_message '[from]="foo.bar at example.com"'
+generate_message '[from]="Baz <foo.bar+baz at example.com>"'
+generate_message '[from]="Foo Bar <foo.bar+baz at example.com>"'
+generate_message '[from]="Baz <foo.bar+baz at example.com>"'
+notmuch new > /dev/null
+
+test_begin_subtest "--deduplicate=no --output=sender"
+notmuch address --deduplicate=no --output=sender from:example.com | sort >OUTPUT
+cat <<EOF >EXPECTED
+Bar <Foo.Bar at Example.Com>
+Baz <foo.bar+baz at example.com>
+Baz <foo.bar+baz at example.com>
+Foo <foo.bar at example.com>
+Foo Bar <Foo.Bar at Example.Com>
+Foo Bar <foo.bar+baz at example.com>
+Foo Bar <foo.bar at example.com>
+Foo Bar <foo.bar at example.com>
+foo.bar at example.com
+foo.bar at example.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "--deduplicate=mailbox --output=sender --output=count"
+notmuch address --deduplicate=mailbox --output=sender --output=count from:example.com | sort -n >OUTPUT
+cat <<EOF >EXPECTED
+1	Bar <Foo.Bar at Example.Com>
+1	Foo <foo.bar at example.com>
+1	Foo Bar <Foo.Bar at Example.Com>
+1	Foo Bar <foo.bar+baz at example.com>
+2	Baz <foo.bar+baz at example.com>
+2	Foo Bar <foo.bar at example.com>
+2	foo.bar at example.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "--deduplicate=address --output=sender --output=count"
+notmuch address --deduplicate=address --output=sender --output=count from:example.com | sort -n >OUTPUT
+cat <<EOF >EXPECTED
+3	Baz <foo.bar+baz at example.com>
+7	Foo Bar <foo.bar at example.com>
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
 test_done
-- 
2.1.4



More information about the notmuch mailing list