[PATCH 5/5] cli: Add tests for 'search --output=addresses' and similar

2014-09-22 Thread Michal Sojka
---
 test/T090-search-output.sh | 59 +++
 test/T095-search-unique.sh | 63 ++
 2 files changed, 122 insertions(+)
 create mode 100755 test/T095-search-unique.sh

diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh
index 947d572..ebc8c37 100755
--- a/test/T090-search-output.sh
+++ b/test/T090-search-output.sh
@@ -387,6 +387,65 @@ cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat OUTPUT
+cat 

[PATCH 5/5] cli: Add tests for 'search --output=addresses' and similar

2014-09-22 Thread Michal Sojka
---
 test/T090-search-output.sh | 59 +++
 test/T095-search-unique.sh | 63 ++
 2 files changed, 122 insertions(+)
 create mode 100755 test/T095-search-unique.sh

diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh
index 947d572..ebc8c37 100755
--- a/test/T090-search-output.sh
+++ b/test/T090-search-output.sh
@@ -387,6 +387,65 @@ cat EOF EXPECTED
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
+test_begin_subtest --output=sender
+notmuch search --output=sender '*' | sort OUTPUT
+cat EOF EXPECTED
+Adrian Perez de Castro ape...@igalia.com
+Alexander Botero-Lowry alex.boterolo...@gmail.com
+Aron Griffis agrif...@n01se.net
+Carl Worth cwo...@cworth.org
+Chris Wilson ch...@chris-wilson.co.uk
+Fran├žois Boulogne boulogn...@gmail.com
+Ingmar Vanhassel ing...@exherbo.org
+Israel Herraiz i...@herraiz.org
+Jan Janak j...@ryngle.com
+Jjgod Jiang gzjj...@gmail.com
+Keith Packard kei...@keithp.com
+Lars Kellogg-Stedman l...@seas.harvard.edu
+Mikhail Gusarov dotted...@dottedmag.net
+Olivier Berger olivier.ber...@it-sudparis.eu
+Rolland Santimano rollandsantim...@yahoo.com
+Stewart Smith stew...@flamingspork.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest --output=recipients
+notmuch search --output=recipients '*' | sort OUTPUT
+cat EOF EXPECTED
+Allan McRae al...@archlinux.org
+Discussion about the Arch User Repository (AUR) aur-gene...@archlinux.org
+Keith Packard kei...@keithp.com
+Mikhail Gusarov dotted...@dottedmag.net
+notmuch@notmuchmail.org
+olivier.ber...@it-sudparis.eu
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest --output=addresses
+notmuch search --output=addresses '*' | sort OUTPUT
+cat EOF EXPECTED
+Adrian Perez de Castro ape...@igalia.com
+Alexander Botero-Lowry alex.boterolo...@gmail.com
+Allan McRae al...@archlinux.org
+Aron Griffis agrif...@n01se.net
+Carl Worth cwo...@cworth.org
+Chris Wilson ch...@chris-wilson.co.uk
+Discussion about the Arch User Repository (AUR) aur-gene...@archlinux.org
+Fran├žois Boulogne boulogn...@gmail.com
+Ingmar Vanhassel ing...@exherbo.org
+Israel Herraiz i...@herraiz.org
+Jan Janak j...@ryngle.com
+Jjgod Jiang gzjj...@gmail.com
+Keith Packard kei...@keithp.com
+Lars Kellogg-Stedman l...@seas.harvard.edu
+Mikhail Gusarov dotted...@dottedmag.net
+Olivier Berger olivier.ber...@it-sudparis.eu
+Rolland Santimano rollandsantim...@yahoo.com
+Stewart Smith stew...@flamingspork.com
+notmuch@notmuchmail.org
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
 test_begin_subtest sanitize output for quoted-printable line-breaks in author 
and subject
 add_message [subject]='two =?ISO-8859-1?Q?line=0A_subject?=
headers'
diff --git a/test/T095-search-unique.sh b/test/T095-search-unique.sh
new file mode 100755
index 000..8fd8fc0
--- /dev/null
+++ b/test/T095-search-unique.sh
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+test_description='address deduplication in notmuch search --output=addresses'
+. ./test-lib.sh
+
+add_message '[to]=Real Name f...@example.com, Real Name b...@example.com'
+add_message '[to]=Nickname f...@example.com' '[cc]=Real Name 
b...@example.com'
+add_message '[to]=Nickname f...@example.com' '[bcc]=Real Name 
b...@example.com'
+
+test_begin_subtest --output=recipients
+notmuch search --output=recipients * OUTPUT
+cat EOF EXPECTED
+Real Name f...@example.com
+Real Name b...@example.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest --output=recipients --unique=none
+notmuch search --output=recipients --unique=none * OUTPUT
+cat EOF EXPECTED
+Real Name f...@example.com
+Real Name b...@example.com
+Nickname f...@example.com
+Real Name b...@example.com
+Nickname f...@example.com
+Real Name b...@example.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest --output=recipients --unique=addr
+notmuch search --output=recipients --unique=addr * OUTPUT
+cat EOF EXPECTED
+Real Name f...@example.com
+Real Name b...@example.com
+Real Name b...@example.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest --output=recipients --unique=addrfold
+notmuch search --output=recipients --unique=addrfold * OUTPUT
+cat EOF EXPECTED
+Real Name f...@example.com
+Real Name b...@example.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest --output=recipients --unique=name
+notmuch search --output=recipients --unique=name * OUTPUT
+cat EOF EXPECTED
+Real Name f...@example.com
+Nickname f...@example.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest --output=recipients --unique=name,addrfold
+notmuch search --output=recipients --unique=name,addrfold * OUTPUT
+cat EOF EXPECTED
+Real Name f...@example.com
+Real Name b...@example.com
+Nickname f...@example.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_done
-- 
2.1.0

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