X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2FT095-address.sh;h=817be5380a45d9a98a7a6bbd2031269575dd13ba;hp=8eecb2a6a7babd041ffd16c75f980c6f408b51bf;hb=0a2929c341b6d5f20210725facf37a6e2c3a19b4;hpb=02a2eeb427d6b424029f6e5e5ddad4c6ec987741 diff --git a/test/T095-address.sh b/test/T095-address.sh index 8eecb2a6..817be538 100755 --- a/test/T095-address.sh +++ b/test/T095-address.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash test_description='"notmuch address" in several variants' -. ./test-lib.sh || exit 1 +. $(dirname "$0")/test-lib.sh || exit 1 add_email_corpus @@ -25,12 +25,12 @@ Adrian Perez de Castro Israel Herraiz Mikhail Gusarov EOF -test_expect_equal_file OUTPUT EXPECTED +test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "without --output" notmuch address '*' >OUTPUT # Use EXPECTED from previous subtest -test_expect_equal_file OUTPUT EXPECTED +test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "--output=sender --format=json" notmuch address --output=sender --format=json '*' >OUTPUT @@ -53,7 +53,7 @@ cat <EXPECTED {"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_expect_equal_file EXPECTED OUTPUT test_begin_subtest "--output=recipients" notmuch address --output=recipients '*' >OUTPUT @@ -66,7 +66,7 @@ notmuch Keith Packard Mikhail Gusarov EOF -test_expect_equal_file OUTPUT EXPECTED +test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "--output=sender --output=recipients" notmuch address --output=sender --output=recipients '*' >OUTPUT @@ -94,7 +94,7 @@ Adrian Perez de Castro Israel Herraiz Mikhail Gusarov EOF -test_expect_equal_file OUTPUT EXPECTED +test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "--output=sender --output=count" notmuch address --output=sender --output=count '*' | sort -n >OUTPUT @@ -117,7 +117,43 @@ cat <EXPECTED 7 Keith Packard 12 Carl Worth EOF -test_expect_equal_file OUTPUT EXPECTED +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "--output=recipients --output=address" +notmuch address --output=recipients --output=address '*' >OUTPUT +cat <EXPECTED +allan@archlinux.org +aur-general@archlinux.org +olivier.berger@it-sudparis.eu +notmuch@notmuchmail.org +notmuch@notmuchmail.org +keithp@keithp.com +dottedmag@dottedmag.net +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "--output=sender --output=address --output=count" +notmuch address --output=sender --output=address --output=count '*' | sort -n >OUTPUT +cat <EXPECTED +1 agriffis@n01se.net +1 aperez@igalia.com +1 boulogne.f@gmail.com +1 chris@chris-wilson.co.uk +1 ingmar@exherbo.org +1 isra@herraiz.org +1 olivier.berger@it-sudparis.eu +1 rollandsantimano@yahoo.com +2 alex.boterolowry@gmail.com +2 gzjjgod@gmail.com +3 stewart@flamingspork.com +4 alex.boterolowry@gmail.com +4 jan@ryngle.com +5 dottedmag@dottedmag.net +5 lars@seas.harvard.edu +7 keithp@keithp.com +12 cworth@cworth.org +EOF +test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "--output=count --format=json" # Since the iteration order of GHashTable is not specified, we @@ -143,6 +179,150 @@ cat <EXPECTED {"name": "Rolland Santimano", "address": "rollandsantimano@yahoo.com", "name-addr": "Rolland Santimano ", "count": 1} {"name": "Stewart Smith", "address": "stewart@flamingspork.com", "name-addr": "Stewart Smith ", "count": 3} EOF -test_expect_equal_file OUTPUT EXPECTED +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "--deduplicate=no --sort=oldest-first --output=sender" +notmuch address --deduplicate=no --sort=oldest-first --output=sender '*' >OUTPUT +cat <EXPECTED +Mikhail Gusarov +Mikhail Gusarov +Carl Worth +Lars Kellogg-Stedman +Mikhail Gusarov +Alex Botero-Lowry +Carl Worth +Lars Kellogg-Stedman +Mikhail Gusarov +Mikhail Gusarov +Keith Packard +Keith Packard +Keith Packard +Jan Janak +Jan Janak +Jan Janak +Israel Herraiz +Adrian Perez de Castro +Aron Griffis +Ingmar Vanhassel +Alex Botero-Lowry +Lars Kellogg-Stedman +Lars Kellogg-Stedman +Lars Kellogg-Stedman +Stewart Smith +Stewart Smith +Keith Packard +Keith Packard +Keith Packard +Stewart Smith +Jjgod Jiang +Jan Janak +Rolland Santimano +Alexander Botero-Lowry +Jjgod Jiang +Alexander Botero-Lowry +Alexander Botero-Lowry +Keith Packard +Alexander Botero-Lowry +Carl Worth +Carl Worth +Carl Worth +Carl Worth +Carl Worth +Carl Worth +Carl Worth +Carl Worth +Carl Worth +Carl Worth +Chris Wilson +Olivier Berger +François Boulogne +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "--deduplicate=no --sort=newest-first --output=sender --output=recipients" +notmuch address --deduplicate=no --sort=newest-first --output=sender --output=recipients path:foo/new >OUTPUT +cat <EXPECTED +Mikhail Gusarov +notmuch@notmuchmail.org +Mikhail Gusarov +notmuch@notmuchmail.org +Lars Kellogg-Stedman +notmuch@notmuchmail.org +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "--deduplicate=address --output=sender --output=recipients" +notmuch address --deduplicate=address --output=sender --output=recipients '*' | sort >OUTPUT +cat <EXPECTED +"Discussion about the Arch User Repository (AUR)" +Adrian Perez de Castro +Alexander Botero-Lowry +Allan McRae +Aron Griffis +Carl Worth +Chris Wilson +François Boulogne +Ingmar Vanhassel +Israel Herraiz +Jan Janak +Jjgod Jiang +Keith Packard +Lars Kellogg-Stedman +Mikhail Gusarov +Olivier Berger +Rolland Santimano +Stewart Smith +notmuch@notmuchmail.org +EOF +test_expect_equal_file EXPECTED OUTPUT + +generate_message '[from]="Foo Bar "' +generate_message '[from]="Foo Bar "' +generate_message '[from]="Foo Bar "' +generate_message '[from]="Bar "' +generate_message '[from]="Foo "' +generate_message '[from]=""' +generate_message '[from]="foo.bar@example.com"' +generate_message '[from]="Baz "' +generate_message '[from]="Foo Bar "' +generate_message '[from]="Baz "' +notmuch new > /dev/null + +test_begin_subtest "--deduplicate=no --output=sender" +notmuch address --deduplicate=no --output=sender from:example.com | sort >OUTPUT +cat <EXPECTED +Bar +Baz +Baz +Foo +Foo Bar +Foo Bar +Foo Bar +Foo Bar +foo.bar@example.com +foo.bar@example.com +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "--deduplicate=mailbox --output=sender --output=count" +notmuch address --deduplicate=mailbox --output=sender --output=count from:example.com | sort -n >OUTPUT +cat <EXPECTED +1 Bar +1 Foo +1 Foo Bar +1 Foo Bar +2 Baz +2 Foo Bar +2 foo.bar@example.com +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "--deduplicate=address --output=sender --output=count" +notmuch address --deduplicate=address --output=sender --output=count from:example.com | sort -n >OUTPUT +cat <EXPECTED +3 Baz +7 Foo Bar +EOF +test_expect_equal_file EXPECTED OUTPUT test_done