[PATCH 06/10] cli: Introduce "notmuch address" command
[notmuch-archives.git] / c0 / c8337706cdfdbd451d442d22b83815949ea5bb
1 Return-Path: <dmitry.kurochkin@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 81D6342116B\r
6         for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:06:55 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id bclLZuBFbWd1 for <notmuch@notmuchmail.org>;\r
17         Thu, 17 Nov 2011 05:06:53 -0800 (PST)\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id ED207429E45\r
22         for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:06:42 -0800 (PST)\r
23 Received: by mail-bw0-f53.google.com with SMTP id q10so2108356bka.26\r
24         for <notmuch@notmuchmail.org>; Thu, 17 Nov 2011 05:06:42 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:date:message-id:x-mailer:in-reply-to:references;\r
27         bh=Xc9GWZb50rFCh1hnIh+nJFHBEPhEm6prvoMXrTP8FsQ=;\r
28         b=u1K+lQwo2jHhkoDFjWRsCG/of6aKmcy8uKO3b8Q2D+vIpBrlEkSmUPqmQNtLereB5k\r
29         7Le6y+w6NmJr+dRpzUQ8tjisW25wdvEPzixFbf5ZJwZy1pdq0KMugJsGHcnigtz8ELWM\r
30         e2EfypM0/DcPDdHOpl2SSw6PzAEVtChpHlmH0=\r
31 Received: by 10.204.145.130 with SMTP id d2mr33880939bkv.78.1321535202642;\r
32         Thu, 17 Nov 2011 05:06:42 -0800 (PST)\r
33 Received: from localhost ([91.144.186.21])\r
34         by mx.google.com with ESMTPS id r12sm41225872bkw.5.2011.11.17.05.06.41\r
35         (version=TLSv1/SSLv3 cipher=OTHER);\r
36         Thu, 17 Nov 2011 05:06:42 -0800 (PST)\r
37 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v2 08/10] test: add function to explicitly check for external\r
40         dependencies\r
41 Date: Thu, 17 Nov 2011 17:06:01 +0400\r
42 Message-Id: <1321535163-4895-9-git-send-email-dmitry.kurochkin@gmail.com>\r
43 X-Mailer: git-send-email 1.7.7.2\r
44 In-Reply-To: <1321535163-4895-1-git-send-email-dmitry.kurochkin@gmail.com>\r
45 References: <1321535163-4895-1-git-send-email-dmitry.kurochkin@gmail.com>\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Thu, 17 Nov 2011 13:06:56 -0000\r
59 \r
60 Useful when binary is called indirectly (e.g. from emacs).\r
61 ---\r
62  test/test-lib.sh |   14 ++++++++++++++\r
63  1 files changed, 14 insertions(+), 0 deletions(-)\r
64 \r
65 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
66 index cf1b4f0..5a99216 100755\r
67 --- a/test/test-lib.sh\r
68 +++ b/test/test-lib.sh\r
69 @@ -533,46 +533,60 @@ test_set_prereq () {\r
70         satisfied="$satisfied$1 "\r
71  }\r
72  satisfied=" "\r
73  \r
74  test_have_prereq () {\r
75         case $satisfied in\r
76         *" $1 "*)\r
77                 : yes, have it ;;\r
78         *)\r
79                 ! : nope ;;\r
80         esac\r
81  }\r
82  \r
83  # declare prerequisite for the given external binary\r
84  test_declare_external_prereq () {\r
85         binary="$1"\r
86         test "$#" = 2 && name=$2 || name="$binary(1)"\r
87  \r
88         hash $binary 2>/dev/null || eval "\r
89  $binary () {\r
90 +       test_missing_external_prereq_${binary}_=t\r
91         echo -n \"\$test_subtest_missing_external_prereqs_\" | grep -e \" $name \" ||\r
92         test_subtest_missing_external_prereqs_=\"$test_subtest_missing_external_prereqs_ $name\"\r
93         false\r
94  }"\r
95  }\r
96  \r
97 +# Explicitly require external prerequisite.  Useful when binary is\r
98 +# called indirectly (e.g. from emacs).\r
99 +# Returns success if dependency is available, failure otherwise.\r
100 +test_require_external_prereq () {\r
101 +       binary="$1"\r
102 +       if [ "$(eval echo -n \$test_missing_external_prereq_${binary}_)" = t ]; then\r
103 +               # dependency is missing, call the replacement function to note it\r
104 +               eval "$binary"\r
105 +       else\r
106 +               true\r
107 +       fi\r
108 +}\r
109 +\r
110  # You are not expected to call test_ok_ and test_failure_ directly, use\r
111  # the text_expect_* functions instead.\r
112  \r
113  test_ok_ () {\r
114         if test "$test_subtest_known_broken_" = "t"; then\r
115                 test_known_broken_ok_ "$@"\r
116                 return\r
117         fi\r
118         test_success=$(($test_success + 1))\r
119         say_color pass "%-6s" "PASS"\r
120         echo " $@"\r
121  }\r
122  \r
123  test_failure_ () {\r
124         if test "$test_subtest_known_broken_" = "t"; then\r
125                 test_known_broken_failure_ "$@"\r
126                 return\r
127         fi\r
128         test_failure=$(($test_failure + 1))\r
129         test_failure_message_ "FAIL" "$@"\r
130 -- \r
131 1.7.7.2\r
132 \r