Re: [Patch v7 2/6] util: add gz_readline
[notmuch-archives.git] / 8c / c11535ce704c9ac6be47418874fe724cd2136b
1 Return-Path: <jrollins@finestructure.net>\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 EAADB431FB6\r
6         for <notmuch@notmuchmail.org>; Wed, 30 May 2012 13:28:43 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.29\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.29 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3, T_MIME_NO_TEXT=0.01] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id GJep2InkF3P9 for <notmuch@notmuchmail.org>;\r
16         Wed, 30 May 2012 13:28:43 -0700 (PDT)\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
18         [131.215.239.19])\r
19         by olra.theworths.org (Postfix) with ESMTP id 54468431FAF\r
20         for <notmuch@notmuchmail.org>; Wed, 30 May 2012 13:28:43 -0700 (PDT)\r
21 Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
22         by earth-doxen-postvirus (Postfix) with ESMTP id DB12466E012C;\r
23         Wed, 30 May 2012 13:28:42 -0700 (PDT)\r
24 X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
25 Received: from finestructure.net (m70.ligo.caltech.edu [131.215.115.170])\r
26         (Authenticated sender: jrollins)\r
27         by earth-doxen-submit (Postfix) with ESMTP id EE36B66E01A4;\r
28         Wed, 30 May 2012 13:28:39 -0700 (PDT)\r
29 Received: by finestructure.net (Postfix, from userid 1000)\r
30         id CF9221D3; Wed, 30 May 2012 13:28:39 -0700 (PDT)\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 To: Mike Kelly <pioto@pioto.org>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH v2 7/9] test/count: fix numeric comparision tests on\r
34         FreeBSD\r
35 In-Reply-To: <1338361324-57289-8-git-send-email-pioto@pioto.org>\r
36 References: <1338361324-57289-1-git-send-email-pioto@pioto.org>\r
37         <1338361324-57289-8-git-send-email-pioto@pioto.org>\r
38 User-Agent: Notmuch/0.13+24~g16915cd (http://notmuchmail.org) Emacs/23.4.1\r
39         (x86_64-pc-linux-gnu)\r
40 Date: Wed, 30 May 2012 13:28:37 -0700\r
41 Message-ID: <877gvtxvka.fsf@servo.finestructure.net>\r
42 MIME-Version: 1.0\r
43 Content-Type: multipart/signed; boundary="=-=-=";\r
44         micalg=pgp-sha256; protocol="application/pgp-signature"\r
45 X-BeenThere: notmuch@notmuchmail.org\r
46 X-Mailman-Version: 2.1.13\r
47 Precedence: list\r
48 List-Id: "Use and development of the notmuch mail system."\r
49         <notmuch.notmuchmail.org>\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
53 List-Post: <mailto:notmuch@notmuchmail.org>\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
57 X-List-Received-Date: Wed, 30 May 2012 20:28:44 -0000\r
58 \r
59 --=-=-=\r
60 \r
61 On Wed, May 30 2012, Mike Kelly <pioto@pioto.org> wrote:\r
62 > FreeBSD's `wc -l` includes some white space in front of the number.\r
63 > Instead, we add a test_expect_equal_num() to test-lib.sh, which ensures\r
64 > we do a proper numeric comparision, and in a portable way.\r
65 \r
66 Is there a way we can avoid adding another new test function here?  This\r
67 new function is almost completely identical with the old one, except\r
68 that it uses "test .. -eq" instead of "[ .. =".  If the problem is just\r
69 that the arguments occasionally contain superfluous spaces, I would\r
70 rather see the existing function just strip the spaces.  Of maybe add an\r
71 option to the test to ask for arithmetic rather than string comparison.\r
72 That would be preferable to introducing an new function that is\r
73 confusingly similar to an existing one.\r
74 \r
75 > +# Like test_expect_equal, but does a numeric comparision instead of a\r
76 > +# string comparision\r
77 > +test_expect_equal_num () {\r
78 > +     exec 1>&6 2>&7          # Restore stdout and stderr\r
79 > +     inside_subtest=\r
80 > +     test "$#" = 3 && { prereq=$1; shift; } || prereq=\r
81 > +     test "$#" = 2 ||\r
82 > +     error "bug in the test script: not 2 or 3 parameters to test_expect_equal"\r
83 > +\r
84 > +     output="$1"\r
85 > +     expected="$2"\r
86 > +     if ! test_skip "$test_subtest_name"\r
87 > +     then\r
88 > +             if test "$output" -eq "$expected"\r
89 > +             then\r
90 > +                     test_ok_ "$test_subtest_name"\r
91 > +             else\r
92 > +                     test_failure_ "$test_subtest_name" "$output != $expected"\r
93 > +             fi\r
94 > +     fi\r
95 > +}\r
96 \r
97 Also, the new function is missing the diff output, which is important\r
98 for debugging, and the syntax is different from the standard we've been\r
99 using:\r
100 \r
101   if ...; then\r
102 \r
103 We try to maintain syntax consistency across the code base.  Thanks.\r
104 \r
105 jamie.\r
106 \r
107 --=-=-=\r
108 Content-Type: application/pgp-signature\r
109 \r
110 -----BEGIN PGP SIGNATURE-----\r
111 Version: GnuPG v1.4.12 (GNU/Linux)\r
112 \r
113 iQIcBAEBCAAGBQJPxoL1AAoJEO00zqvie6q8y04P/Av7haRAPhHgXVkRR1kJVnom\r
114 CIoEpbKq6yHz8M9dYyNpZ/zz8vFvjvZm6JghKkiHKPz1FXjY25GBjM2jeyxXVZ46\r
115 xQ8IYT6K8GYfiRLKGMUZJLc6OXETKcHxsGRIzGP+rSsAOHWss3lKJxlJutrfz5rI\r
116 pZuo4m2fKiYm9Qiiu1V2/s2xWtD0ZGftf3zi/SetkYTHNhSNN/gi57SxGfb0I7bs\r
117 /ed0uDYLNPpbm+dRP/DnsLOFGbeCDRz5tMGa1zeKgfg3oAvzPwGrjYwn+HKVkloh\r
118 Xsk1sgswZSE0z08xi0w5i6l0aDjXE9Z11hT15T3mwzLmjkpNJOGCl8Mi3D45+PJa\r
119 XIPr6bTmEspPQq22ZANcKTT324597ER0SZR5tCCTOpaPDU6GmahxwocUonNZQWq+\r
120 D0Oamy9qInDQJJ+eDHX2xjSr6/6X6yi2gT9bz2z71hO2xN0dtTgyNs9DdUZwBjeR\r
121 bJ5MR56o85xZzo2Eml30aZa9ujgbW28HVCvrjh3jEdoqb/blevCGqOXs63brwTLX\r
122 xqCpDMCYPKbMe1tU3i5qiPAHCd3VJftuYAVTo3QhPRWS/5cmOD/eAgyGsW/G7NNo\r
123 YzgmNMz/NCqGm/Hn1aLhGLdKdnAzUZNF5PlYatzwTvo/wS9ZU4XWs6LnlUXTkaBI\r
124 gvYA2B7ojIgiDLzgUK73\r
125 =dKfi\r
126 -----END PGP SIGNATURE-----\r
127 --=-=-=--\r