Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / c9 / 29f07ad0fa011c14a2469ba754fa6851bc19ab
1 Return-Path: <jani@nikula.org>\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 DB8CA429E3C\r
6         for <notmuch@notmuchmail.org>; Sun, 13 Nov 2011 11:49:21 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: -0.7\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
13         tests=[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 tFZLp1kicQvJ for <notmuch@notmuchmail.org>;\r
17         Sun, 13 Nov 2011 11:49:20 -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 53C51429E3B\r
22         for <notmuch@notmuchmail.org>; Sun, 13 Nov 2011 11:49:09 -0800 (PST)\r
23 Received: by mail-bw0-f53.google.com with SMTP id q10so6225076bka.26\r
24         for <notmuch@notmuchmail.org>; Sun, 13 Nov 2011 11:49:08 -0800 (PST)\r
25 Received: by 10.205.133.148 with SMTP id hy20mr8676429bkc.132.1321213748757;\r
26         Sun, 13 Nov 2011 11:49:08 -0800 (PST)\r
27 Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi.\r
28         [80.220.92.23])\r
29         by mx.google.com with ESMTPS id dq2sm26570516bkb.11.2011.11.13.11.49.06\r
30         (version=SSLv3 cipher=OTHER); Sun, 13 Nov 2011 11:49:07 -0800 (PST)\r
31 From: Jani Nikula <jani@nikula.org>\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH v5 6/6] test: add tests for notmuch search --first and\r
34         --maxitems\r
35 Date: Sun, 13 Nov 2011 21:48:40 +0200\r
36 Message-Id:\r
37  <6d002ff36bf213063ce1ffa327e089eb71b4f83e.1321212673.git.jani@nikula.org>\r
38 X-Mailer: git-send-email 1.7.5.4\r
39 In-Reply-To: <cover.1321212673.git.jani@nikula.org>\r
40 References: <cover.1321212673.git.jani@nikula.org>\r
41 In-Reply-To: <cover.1321212673.git.jani@nikula.org>\r
42 References: <cover.1321212673.git.jani@nikula.org>\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Sun, 13 Nov 2011 19:49:22 -0000\r
56 \r
57 Signed-off-by: Jani Nikula <jani@nikula.org>\r
58 ---\r
59  test/notmuch-test    |    1 +\r
60  test/search-limiting |   71 ++++++++++++++++++++++++++++++++++++++++++++++++++\r
61  2 files changed, 72 insertions(+), 0 deletions(-)\r
62  create mode 100755 test/search-limiting\r
63 \r
64 diff --git a/test/notmuch-test b/test/notmuch-test\r
65 index 587adb5..435b469 100755\r
66 --- a/test/notmuch-test\r
67 +++ b/test/notmuch-test\r
68 @@ -25,6 +25,7 @@ TESTS="\r
69    search-by-folder\r
70    search-position-overlap-bug\r
71    search-insufficient-from-quoting\r
72 +  search-limiting\r
73    json\r
74    multipart\r
75    thread-naming\r
76 diff --git a/test/search-limiting b/test/search-limiting\r
77 new file mode 100755\r
78 index 0000000..45cc0a9\r
79 --- /dev/null\r
80 +++ b/test/search-limiting\r
81 @@ -0,0 +1,71 @@\r
82 +#!/usr/bin/env bash\r
83 +test_description='"notmuch search" --first and --maxitems parameters'\r
84 +. ./test-lib.sh\r
85 +\r
86 +add_email_corpus\r
87 +\r
88 +for outp in messages threads; do\r
89 +    test_begin_subtest "${outp}: maxitems does the right thing"\r
90 +    notmuch search --output=${outp} "*" | head -n 20 >expected\r
91 +    notmuch search --output=${outp} --maxitems=20 "*" >output\r
92 +    test_expect_equal_file expected output\r
93 +\r
94 +    test_begin_subtest "${outp}: concatenation of limited searches"\r
95 +    notmuch search --output=${outp} "*" | head -n 20 >expected\r
96 +    notmuch search --output=${outp} --maxitems=10 "*" >output\r
97 +    notmuch search --output=${outp} --maxitems=10 --first=10 "*" >>output\r
98 +    test_expect_equal_file expected output\r
99 +\r
100 +    test_begin_subtest "${outp}: maxitems larger than result set"\r
101 +    N=`notmuch count --output=${outp} "*"`\r
102 +    notmuch search --output=${outp} "*" >expected\r
103 +    notmuch search --output=${outp} --maxitems=$((1 + ${N})) "*" >output\r
104 +    test_expect_equal_file expected output\r
105 +\r
106 +    test_begin_subtest "${outp}: maxitems = 0"\r
107 +    test_expect_equal "`notmuch search --output=${outp} --maxitems=0 "*"`" ""\r
108 +\r
109 +    test_begin_subtest "${outp}: first does the right thing"\r
110 +    # note: tail -n +N is 1-based\r
111 +    notmuch search --output=${outp} "*" | tail -n +21 >expected\r
112 +    notmuch search --output=${outp} --first=20 "*" >output\r
113 +    test_expect_equal_file expected output\r
114 +\r
115 +    test_begin_subtest "${outp}: first = 0"\r
116 +    notmuch search --output=${outp} "*" >expected\r
117 +    notmuch search --output=${outp} --first=0 "*" >output\r
118 +    test_expect_equal_file expected output\r
119 +\r
120 +    test_begin_subtest "${outp}: negative first"\r
121 +    notmuch search --output=${outp} "*" | tail -n 20 >expected\r
122 +    notmuch search --output=${outp} --first=-20 "*" >output\r
123 +    test_expect_equal_file expected output\r
124 +\r
125 +    test_begin_subtest "${outp}: negative first"\r
126 +    notmuch search --output=${outp} "*" | tail -n 1 >expected\r
127 +    notmuch search --output=${outp} --first=-1 "*" >output\r
128 +    test_expect_equal_file expected output\r
129 +\r
130 +    test_begin_subtest "${outp}: negative first combined with maxitems"\r
131 +    notmuch search --output=${outp} "*" | tail -n 20 | head -n 10 >expected\r
132 +    notmuch search --output=${outp} --first=-20 --maxitems=10 "*" >output\r
133 +    test_expect_equal_file expected output\r
134 +\r
135 +    test_begin_subtest "${outp}: negative first combined with equal maxitems"\r
136 +    notmuch search --output=${outp} "*" | tail -n 20 >expected\r
137 +    notmuch search --output=${outp} --first=-20 --maxitems=20 "*" >output\r
138 +    test_expect_equal_file expected output\r
139 +\r
140 +    test_begin_subtest "${outp}: negative first combined with large maxitems"\r
141 +    notmuch search --output=${outp} "*" | tail -n 20 >expected\r
142 +    notmuch search --output=${outp} --first=-20 --maxitems=50 "*" >output\r
143 +    test_expect_equal_file expected output\r
144 +\r
145 +    test_begin_subtest "${outp}: negative first larger then results"\r
146 +    N=`notmuch count --output=${outp} "*"`\r
147 +    notmuch search --output=${outp} "*" >expected\r
148 +    notmuch search --output=${outp} --first=-$((1 + ${N})) "*" >output\r
149 +    test_expect_equal_file expected output\r
150 +done\r
151 +\r
152 +test_done\r
153 -- \r
154 1.7.5.4\r
155 \r