#!/usr/bin/env bash test_description='"notmuch address" in several variants' . ./test-lib.sh add_email_corpus test_begin_subtest "--output=sender" notmuch address --output=sender '*' >OUTPUT cat <EXPECTED François Boulogne Olivier Berger Chris Wilson Carl Worth Alexander Botero-Lowry Keith Packard Jjgod Jiang Rolland Santimano Jan Janak Stewart Smith Lars Kellogg-Stedman Alex Botero-Lowry Ingmar Vanhassel Aron Griffis Adrian Perez de Castro Israel Herraiz Mikhail Gusarov EOF test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "--output=sender --format=json" notmuch address --output=sender --format=json '*' >OUTPUT cat <EXPECTED [{"name": "François Boulogne", "address": "boulogne.f@gmail.com", "name-addr": "François Boulogne "}, {"name": "Olivier Berger", "address": "olivier.berger@it-sudparis.eu", "name-addr": "Olivier Berger "}, {"name": "Chris Wilson", "address": "chris@chris-wilson.co.uk", "name-addr": "Chris Wilson "}, {"name": "Carl Worth", "address": "cworth@cworth.org", "name-addr": "Carl Worth "}, {"name": "Alexander Botero-Lowry", "address": "alex.boterolowry@gmail.com", "name-addr": "Alexander Botero-Lowry "}, {"name": "Keith Packard", "address": "keithp@keithp.com", "name-addr": "Keith Packard "}, {"name": "Jjgod Jiang", "address": "gzjjgod@gmail.com", "name-addr": "Jjgod Jiang "}, {"name": "Rolland Santimano", "address": "rollandsantimano@yahoo.com", "name-addr": "Rolland Santimano "}, {"name": "Jan Janak", "address": "jan@ryngle.com", "name-addr": "Jan Janak "}, {"name": "Stewart Smith", "address": "stewart@flamingspork.com", "name-addr": "Stewart Smith "}, {"name": "Lars Kellogg-Stedman", "address": "lars@seas.harvard.edu", "name-addr": "Lars Kellogg-Stedman "}, {"name": "Alex Botero-Lowry", "address": "alex.boterolowry@gmail.com", "name-addr": "Alex Botero-Lowry "}, {"name": "Ingmar Vanhassel", "address": "ingmar@exherbo.org", "name-addr": "Ingmar Vanhassel "}, {"name": "Aron Griffis", "address": "agriffis@n01se.net", "name-addr": "Aron Griffis "}, {"name": "Adrian Perez de Castro", "address": "aperez@igalia.com", "name-addr": "Adrian Perez de Castro "}, {"name": "Israel Herraiz", "address": "isra@herraiz.org", "name-addr": "Israel Herraiz "}, {"name": "Mikhail Gusarov", "address": "dottedmag@dottedmag.net", "name-addr": "Mikhail Gusarov "}] EOF test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "--output=recipients" notmuch address --output=recipients '*' >OUTPUT cat <EXPECTED Allan McRae "Discussion about the Arch User Repository (AUR)" olivier.berger@it-sudparis.eu notmuch@notmuchmail.org notmuch Keith Packard Mikhail Gusarov EOF test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "--output=sender --output=recipients" notmuch address --output=sender --output=recipients '*' >OUTPUT cat <EXPECTED François Boulogne Allan McRae "Discussion about the Arch User Repository (AUR)" Olivier Berger olivier.berger@it-sudparis.eu Chris Wilson notmuch@notmuchmail.org Carl Worth Alexander Botero-Lowry Keith Packard Jjgod Jiang Rolland Santimano Jan Janak Stewart Smith Lars Kellogg-Stedman notmuch Alex Botero-Lowry Ingmar Vanhassel Aron Griffis Adrian Perez de Castro Israel Herraiz Mikhail Gusarov EOF test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "without --output" notmuch address '*' >OUTPUT # Use EXPECTED from previous subtest test_expect_equal_file OUTPUT EXPECTED test_done