[PATCH 3/6] WIP/test: (count ...) tests for to / from

Subject: [PATCH 3/6] WIP/test: (count ...) tests for to / from

Date: Sat, 18 Feb 2023 13:17:34 -0400

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


---
 test/T083-sexpr-count.sh | 85 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/test/T083-sexpr-count.sh b/test/T083-sexpr-count.sh
index e825ef3d..f3010d11 100755
--- a/test/T083-sexpr-count.sh
+++ b/test/T083-sexpr-count.sh
@@ -27,4 +27,89 @@ cat <<EOF >EXPECTED
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "from addresses with any count"
+notmuch address --query=sexp '(from (count 1 *))' | sort > OUTPUT
+cat <<EOF >EXPECTED
+Adrian Perez de Castro <aperez@igalia.com>
+Alex Botero-Lowry <alex.boterolowry@gmail.com>
+Alexander Botero-Lowry <alex.boterolowry@gmail.com>
+Aron Griffis <agriffis@n01se.net>
+Carl Worth <cworth@cworth.org>
+Chris Wilson <chris@chris-wilson.co.uk>
+Fran├žois Boulogne <boulogne.f@gmail.com>
+Ingmar Vanhassel <ingmar@exherbo.org>
+Israel Herraiz <isra@herraiz.org>
+Jan Janak <jan@ryngle.com>
+Jjgod Jiang <gzjjgod@gmail.com>
+Keith Packard <keithp@keithp.com>
+Lars Kellogg-Stedman <lars@seas.harvard.edu>
+Mikhail Gusarov <dottedmag@dottedmag.net>
+Olivier Berger <olivier.berger@it-sudparis.eu>
+Rolland Santimano <rollandsantimano@yahoo.com>
+Stewart Smith <stewart@flamingspork.com>
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "from addresses with unique words"
+notmuch address --query=sexp '(from (count 1))' | sort > OUTPUT
+cat <<EOF >EXPECTED
+Adrian Perez de Castro <aperez@igalia.com>
+Aron Griffis <agriffis@n01se.net>
+Chris Wilson <chris@chris-wilson.co.uk>
+Fran├žois Boulogne <boulogne.f@gmail.com>
+Ingmar Vanhassel <ingmar@exherbo.org>
+Israel Herraiz <isra@herraiz.org>
+Olivier Berger <olivier.berger@it-sudparis.eu>
+Rolland Santimano <rollandsantimano@yahoo.com>
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "from addresses with only non-unique words"
+notmuch address --query=sexp '(from (not (count 1)))' | sort > OUTPUT
+cat <<EOF >EXPECTED
+Alex Botero-Lowry <alex.boterolowry@gmail.com>
+Alexander Botero-Lowry <alex.boterolowry@gmail.com>
+Carl Worth <cworth@cworth.org>
+Jan Janak <jan@ryngle.com>
+Jjgod Jiang <gzjjgod@gmail.com>
+Keith Packard <keithp@keithp.com>
+Lars Kellogg-Stedman <lars@seas.harvard.edu>
+Mikhail Gusarov <dottedmag@dottedmag.net>
+Stewart Smith <stewart@flamingspork.com>
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "to addresses with any count"
+notmuch address --output=recipients --deduplicate=address --output=address \
+	--query=sexp '(to (count 1 *))' | sort >OUTPUT
+cat <<EOF >EXPECTED
+allan@archlinux.org
+aur-general@archlinux.org
+dottedmag@dottedmag.net
+keithp@keithp.com
+notmuch@notmuchmail.org
+olivier.berger@it-sudparis.eu
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "to addresses with unique words"
+notmuch address --query=sexp --output=recipients --output=address '(to (count 1))' | sort > OUTPUT
+cat <<EOF >EXPECTED
+allan@archlinux.org
+aur-general@archlinux.org
+dottedmag@dottedmag.net
+keithp@keithp.com
+notmuch@notmuchmail.org
+olivier.berger@it-sudparis.eu
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "to addresses with only non-unique words"
+notmuch address --output=recipients --deduplicate=address --output=address \
+	--query=sexp '(to (not (count 1)))' | sort > OUTPUT
+cat <<EOF >EXPECTED
+notmuch@notmuchmail.org
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done
-- 
2.39.1

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: