[PATCH 5/5] cli: Add tests for 'search --output=addresses' and similar
Michal Sojka
sojkam1 at fel.cvut.cz
Mon Sep 22 02:37:59 PDT 2014
---
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 <aperez at igalia.com>
+Alexander Botero-Lowry <alex.boterolowry at gmail.com>
+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>
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "--output=recipients"
+notmuch search --output=recipients '*' | sort >OUTPUT
+cat <<EOF >EXPECTED
+Allan McRae <allan at archlinux.org>
+Discussion about the Arch User Repository (AUR) <aur-general at archlinux.org>
+Keith Packard <keithp at keithp.com>
+Mikhail Gusarov <dottedmag at dottedmag.net>
+notmuch at notmuchmail.org
+olivier.berger at 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 <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>
+Discussion about the Arch User Repository (AUR) <aur-general at archlinux.org>
+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
+
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 0000000..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 <foo at example.com>, Real Name <bar at example.com>"'
+add_message '[to]="Nickname <foo at example.com>"' '[cc]="Real Name <Bar at Example.COM>"'
+add_message '[to]="Nickname <foo at example.com>"' '[bcc]="Real Name <Bar at Example.COM>"'
+
+test_begin_subtest "--output=recipients"
+notmuch search --output=recipients "*" >OUTPUT
+cat <<EOF >EXPECTED
+Real Name <foo at example.com>
+Real Name <bar at 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 <foo at example.com>
+Real Name <bar at example.com>
+Nickname <foo at example.com>
+Real Name <Bar at Example.COM>
+Nickname <foo at example.com>
+Real Name <Bar at 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 <foo at example.com>
+Real Name <bar at example.com>
+Real Name <Bar at 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 <foo at example.com>
+Real Name <bar at 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 <foo at example.com>
+Nickname <foo at 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 <foo at example.com>
+Real Name <bar at example.com>
+Nickname <foo at example.com>
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_done
--
2.1.0
More information about the notmuch
mailing list