Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 66 / d023d3dfbc65b818b61f3e0a7ceb2172077a52
1 Return-Path: <jeff@ocjtech.us>\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 535A8431FBC\r
6         for <notmuch@notmuchmail.org>; Sat, 28 Nov 2009 08:02:11 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id M11WnB12BS9t for <notmuch@notmuchmail.org>;\r
11         Sat, 28 Nov 2009 08:02:10 -0800 (PST)\r
12 Received: from mail-yx0-f187.google.com (mail-yx0-f187.google.com\r
13         [209.85.210.187])\r
14         by olra.theworths.org (Postfix) with ESMTP id 4E438431FAE\r
15         for <notmuch@notmuchmail.org>; Sat, 28 Nov 2009 08:02:10 -0800 (PST)\r
16 Received: by yxe17 with SMTP id 17so2329653yxe.33\r
17         for <notmuch@notmuchmail.org>; Sat, 28 Nov 2009 08:02:10 -0800 (PST)\r
18 Received: by 10.90.62.22 with SMTP id k22mr3244937aga.48.1259424129807;\r
19         Sat, 28 Nov 2009 08:02:09 -0800 (PST)\r
20 Received: from max1.ocjtech.us ([69.57.47.215])\r
21         by mx.google.com with ESMTPS id 15sm1244361yxh.22.2009.11.28.08.02.08\r
22         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
23         Sat, 28 Nov 2009 08:02:08 -0800 (PST)\r
24 Received: from localhost ([127.0.0.1] helo=localhost.localdomain)\r
25         by max1.ocjtech.us with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69)\r
26         (envelope-from <jeff@ocjtech.us>)\r
27         id 1NEPkN-0006qV-Ac; Sat, 28 Nov 2009 10:02:07 -0600\r
28 From: "Jeffrey C. Ollie" <jeff@ocjtech.us>\r
29 To: Not Much Mail <notmuch@notmuchmail.org>\r
30 Date: Sat, 28 Nov 2009 10:02:03 -0600\r
31 Message-Id: <1259424123-26285-1-git-send-email-jeff@ocjtech.us>\r
32 X-Mailer: git-send-email 1.6.5.2\r
33 Subject: [notmuch] [PATCH] Add the beginnings of a test suite.\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.12\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38         <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
40         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Sat, 28 Nov 2009 16:02:11 -0000\r
47 \r
48 This is the beginning of a test suite.  It uses the Check[1] unit\r
49 testing framework to handle the testing.  There's one basic test of\r
50 the SHA1 routines, obviously many more will need to be added.\r
51 \r
52 Run "make check" from the toplevel directory to build and run the\r
53 checks.\r
54 \r
55 [1] http://check.sourceforge.net/\r
56 \r
57 Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>\r
58 ---\r
59  .gitignore            |    1 +\r
60  Makefile              |    1 +\r
61  Makefile.local        |    3 ++\r
62  checks/Makefile.local |   12 +++++++++\r
63  checks/check.c        |   61 +++++++++++++++++++++++++++++++++++++++++++++++++\r
64  configure             |    8 ++++++\r
65  6 files changed, 86 insertions(+), 0 deletions(-)\r
66  create mode 100644 checks/Makefile.local\r
67  create mode 100644 checks/check.c\r
68 \r
69 diff --git a/.gitignore b/.gitignore\r
70 index 8794354..bd542d9 100644\r
71 --- a/.gitignore\r
72 +++ b/.gitignore\r
73 @@ -8,3 +8,4 @@ notmuch.1.gz\r
74  *~\r
75  .*.swp\r
76  *.elc\r
77 +checks/check\r
78 diff --git a/Makefile b/Makefile\r
79 index 2cd1b1b..1a4c8db 100644\r
80 --- a/Makefile\r
81 +++ b/Makefile\r
82 @@ -33,6 +33,7 @@ override LDFLAGS += \\r
83  # Include our local Makefile.local first so that its first target is default\r
84  include Makefile.local\r
85  include lib/Makefile.local\r
86 +include checks/Makefile.local\r
87  \r
88  # And get user settings from the output of configure\r
89  include Makefile.config\r
90 diff --git a/Makefile.local b/Makefile.local\r
91 index 1744747..f6ffd00 100644\r
92 --- a/Makefile.local\r
93 +++ b/Makefile.local\r
94 @@ -47,5 +47,8 @@ install-emacs: install emacs\r
95         install -m0644 notmuch.el $(DESTDIR)$(emacs_lispdir)\r
96         install -m0644 notmuch.elc $(DESTDIR)$(emacs_lispdir)\r
97  \r
98 +check: checks/check\r
99 +       checks/check\r
100 +\r
101  SRCS  := $(SRCS) $(notmuch_client_srcs)\r
102  CLEAN := $(CLEAN) notmuch $(notmuch_client_modules) notmuch.elc notmuch.1.gz\r
103 diff --git a/checks/Makefile.local b/checks/Makefile.local\r
104 new file mode 100644\r
105 index 0000000..ec34d17\r
106 --- /dev/null\r
107 +++ b/checks/Makefile.local\r
108 @@ -0,0 +1,12 @@\r
109 +dir=checks\r
110 +extra_cflags += -I../lib\r
111 +\r
112 +check_c_srcs =         \\r
113 +       $(dir)/check.c\r
114 +\r
115 +check_modules = $(check_c_srcs:.c=.o)\r
116 +$(dir)/check: $(check_modules)\r
117 +       $(call quiet,CXX) $^ $(LDFLAGS) -o $@ lib/notmuch.a -lcheck\r
118 +\r
119 +SRCS  := $(SRCS) $(check_c_srcs)\r
120 +CLEAN := $(CLEAN) $(check_modules) $(dir)/check\r
121 diff --git a/checks/check.c b/checks/check.c\r
122 new file mode 100644\r
123 index 0000000..8886f1f\r
124 --- /dev/null\r
125 +++ b/checks/check.c\r
126 @@ -0,0 +1,61 @@\r
127 +/* notmuch - Not much of an email program, (just index and search)\r
128 + *\r
129 + * Copyright © 2009 Jeffrey C. Ollie\r
130 + *\r
131 + * This program is free software: you can redistribute it and/or modify\r
132 + * it under the terms of the GNU General Public License as published by\r
133 + * the Free Software Foundation, either version 3 of the License, or\r
134 + * (at your option) any later version.\r
135 + *\r
136 + * This program is distributed in the hope that it will be useful,\r
137 + * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
138 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
139 + * GNU General Public License for more details.\r
140 + *\r
141 + * You should have received a copy of the GNU General Public License\r
142 + * along with this program.  If not, see http://www.gnu.org/licenses/ .\r
143 + *\r
144 + * Authors: Jeffrey C. Ollie <jeff@ocjtech.us>\r
145 + */\r
146 +\r
147 +#include <check.h>\r
148 +#include <string.h>\r
149 +\r
150 +#include "notmuch-private.h"\r
151 +\r
152 +START_TEST (test_sha1_simple)\r
153 +{\r
154 +   char *result;\r
155 +\r
156 +   result = notmuch_sha1_of_string("abcdefghi");\r
157 +   fail_if(strcmp("e1435dfb334ec81f2bdd5b0aa45969586e7681c0", result) != 0,\r
158 +          "SHA1 results do not match");\r
159 +}\r
160 +END_TEST\r
161 +\r
162 +Suite *\r
163 +notmuch_suite (void)\r
164 +{\r
165 +   Suite *s = suite_create ("NotMuch");\r
166 +   \r
167 +   /* SHA1 test cases */\r
168 +   TCase *tc_sha1 = tcase_create ("SHA1");\r
169 +   tcase_add_test (tc_sha1, test_sha1_simple);\r
170 +   suite_add_tcase (s, tc_sha1);\r
171 +   return s;\r
172 +}\r
173 +\r
174 +int\r
175 +main (void)\r
176 +{\r
177 +   int number_failed;\r
178 +\r
179 +   Suite *s = notmuch_suite ();\r
180 +   SRunner *sr = srunner_create (s);\r
181 +\r
182 +   srunner_run_all (sr, CK_VERBOSE);\r
183 +   number_failed = srunner_ntests_failed (sr);\r
184 +   srunner_free (sr);\r
185 +\r
186 +   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;\r
187 +}\r
188 diff --git a/configure b/configure\r
189 index e55f067..9e76f09 100755\r
190 --- a/configure\r
191 +++ b/configure\r
192 @@ -61,6 +61,14 @@ else\r
193      have_valgrind=\r
194  fi\r
195  \r
196 +if pkg-config --exists check > /dev/null 2>&1; then\r
197 +    echo "Checking for the Check unit test framework... Yes."\r
198 +    have_check=1\r
199 +else\r
200 +    echo "Checking for the Check unit test framework... No."\r
201 +    have_check=\r
202 +fi\r
203 +\r
204  if [ $errors -gt 0 ]; then\r
205      cat <<EOF\r
206  \r
207 -- \r
208 1.6.5.2\r
209 \r