1 Return-Path: <bremner@tesseract.cs.unb.ca>
\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 B3322431FDA
\r
6 for <notmuch@notmuchmail.org>; Tue, 30 Dec 2014 12:30:50 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 fkWVumuvjaeQ for <notmuch@notmuchmail.org>;
\r
16 Tue, 30 Dec 2014 12:30:47 -0800 (PST)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 7228E431FCB
\r
21 for <notmuch@notmuchmail.org>; Tue, 30 Dec 2014 12:30:47 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tesseract.cs.unb.ca>)
\r
24 id 1Y63RH-00010Q-7B; Tue, 30 Dec 2014 16:30:47 -0400
\r
25 Received: (nullmailer pid 10595 invoked by uid 1000); Tue, 30 Dec 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [Patch v2 3/5] test: port existing python tests to ruby
\r
30 Date: Tue, 30 Dec 2014 21:29:38 +0100
\r
31 Message-Id: <1419971380-10307-4-git-send-email-david@tethera.net>
\r
32 X-Mailer: git-send-email 2.1.3
\r
33 In-Reply-To: <1419971380-10307-1-git-send-email-david@tethera.net>
\r
34 References: <1419971380-10307-1-git-send-email-david@tethera.net>
\r
35 X-BeenThere: notmuch@notmuchmail.org
\r
36 X-Mailman-Version: 2.1.13
\r
38 List-Id: "Use and development of the notmuch mail system."
\r
39 <notmuch.notmuchmail.org>
\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
41 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
43 List-Post: <mailto:notmuch@notmuchmail.org>
\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
47 X-List-Received-Date: Tue, 30 Dec 2014 20:30:51 -0000
\r
49 This is pretty much a line by line translation. Add a dependency of
\r
50 the test suite on the ruby bindings, as these are currently not built
\r
53 test/Makefile.local | 2 +-
\r
54 test/T395-ruby.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
55 test/test-lib.sh | 5 ++++
\r
56 3 files changed, 92 insertions(+), 1 deletion(-)
\r
57 create mode 100755 test/T395-ruby.sh
\r
59 diff --git a/test/Makefile.local b/test/Makefile.local
\r
60 index 2331ceb..9423680 100644
\r
61 --- a/test/Makefile.local
\r
62 +++ b/test/Makefile.local
\r
63 @@ -55,7 +55,7 @@ TEST_BINARIES := $(TEST_BINARIES:.cc=)
\r
65 test-binaries: $(TEST_BINARIES)
\r
67 -test: all test-binaries
\r
68 +test: all test-binaries ruby-bindings
\r
69 @${test_src_dir}/notmuch-test $(OPTIONS)
\r
72 diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh
\r
73 new file mode 100755
\r
74 index 0000000..6b89a5d
\r
76 +++ b/test/T395-ruby.sh
\r
78 +#!/usr/bin/env bash
\r
79 +test_description="ruby bindings"
\r
82 +if [ "${NOTMUCH_HAVE_RUBY_DEV}" = "0" ]; then
\r
83 + test_subtest_missing_external_prereq_["ruby development files"]=t
\r
88 +test_begin_subtest "compare thread ids"
\r
91 +$maildir = ENV['MAIL_DIR']
\r
92 +if not $maildir then
\r
93 + abort('environment variable MAIL_DIR must be set')
\r
95 +@db = Notmuch::Database.new($maildir)
\r
96 +@q = @db.query('tag:inbox')
\r
97 +@q.sort = Notmuch::SORT_OLDEST_FIRST
\r
98 +for t in @q.search_threads do
\r
99 + print t.thread_id, "\n"
\r
102 +notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
\r
103 +test_expect_equal_file OUTPUT EXPECTED
\r
105 +test_begin_subtest "compare message ids"
\r
108 +$maildir = ENV['MAIL_DIR']
\r
109 +if not $maildir then
\r
110 + abort('environment variable MAIL_DIR must be set')
\r
112 +@db = Notmuch::Database.new($maildir)
\r
113 +@q = @db.query('tag:inbox')
\r
114 +@q.sort = Notmuch::SORT_OLDEST_FIRST
\r
115 +for m in @q.search_messages do
\r
116 + print m.message_id, "\n"
\r
119 +notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
\r
120 +test_expect_equal_file OUTPUT EXPECTED
\r
122 +test_begin_subtest "get non-existent file"
\r
125 +$maildir = ENV['MAIL_DIR']
\r
126 +if not $maildir then
\r
127 + abort('environment variable MAIL_DIR must be set')
\r
129 +@db = Notmuch::Database.new($maildir)
\r
130 +result = @db.find_message_by_filename('i-dont-exist')
\r
131 +print (result == nil)
\r
133 +test_expect_equal "$(cat OUTPUT)" "true"
\r
135 +test_begin_subtest "count messages"
\r
138 +$maildir = ENV['MAIL_DIR']
\r
139 +if not $maildir then
\r
140 + abort('environment variable MAIL_DIR must be set')
\r
142 +@db = Notmuch::Database.new($maildir)
\r
143 +@q = @db.query('tag:inbox')
\r
144 +print @q.count_messages(),"\n"
\r
146 +notmuch count --output=messages tag:inbox > EXPECTED
\r
147 +test_expect_equal_file OUTPUT EXPECTED
\r
149 +test_begin_subtest "count messages"
\r
152 +$maildir = ENV['MAIL_DIR']
\r
153 +if not $maildir then
\r
154 + abort('environment variable MAIL_DIR must be set')
\r
156 +@db = Notmuch::Database.new($maildir)
\r
157 +@q = @db.query('tag:inbox')
\r
158 +print @q.count_threads(),"\n"
\r
160 +notmuch count --output=threads tag:inbox > EXPECTED
\r
161 +test_expect_equal_file OUTPUT EXPECTED
\r
164 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
165 index 53db9ca..3bbdc03 100644
\r
166 --- a/test/test-lib.sh
\r
167 +++ b/test/test-lib.sh
\r
168 @@ -1156,6 +1156,11 @@ test_python() {
\r
173 + export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
\r
174 + MAIL_DIR=$MAIL_DIR ruby -I $TEST_DIRECTORY/../bindings/ruby> OUTPUT
\r
177 # Creates a script that counts how much time it is executed and calls
\r
178 # notmuch. $notmuch_counter_command is set to the path to the
\r
179 # generated script. Use notmuch_counter_value() function to get the
\r