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 7B594429E30
\r
6 for <notmuch@notmuchmail.org>; Thu, 1 Jan 2015 04:17:18 -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 3zaPl-ghD6wt for <notmuch@notmuchmail.org>;
\r
16 Thu, 1 Jan 2015 04:17:16 -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 CEFF5431FCB
\r
21 for <notmuch@notmuchmail.org>; Thu, 1 Jan 2015 04:17:06 -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 1Y6egc-00053k-EP; Thu, 01 Jan 2015 08:17:06 -0400
\r
25 Received: (nullmailer pid 28823 invoked by uid 1000); Thu, 01 Jan 2015
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [PATCH 5/5] test: add initial ruby tests
\r
30 Date: Thu, 1 Jan 2015 13:16:40 +0100
\r
31 Message-Id: <1420114600-28396-6-git-send-email-david@tethera.net>
\r
32 X-Mailer: git-send-email 2.1.3
\r
33 In-Reply-To: <1420114600-28396-1-git-send-email-david@tethera.net>
\r
34 References: <1420114600-28396-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: Thu, 01 Jan 2015 12:17:18 -0000
\r
49 This is pretty much a line by line translation of the existing python
\r
50 tests, with two new tests for the count API.
\r
52 test/T395-ruby.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
53 test/test-lib.sh | 5 ++++
\r
54 2 files changed, 91 insertions(+)
\r
55 create mode 100755 test/T395-ruby.sh
\r
57 diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh
\r
58 new file mode 100755
\r
59 index 0000000..6b89a5d
\r
61 +++ b/test/T395-ruby.sh
\r
63 +#!/usr/bin/env bash
\r
64 +test_description="ruby bindings"
\r
67 +if [ "${NOTMUCH_HAVE_RUBY_DEV}" = "0" ]; then
\r
68 + test_subtest_missing_external_prereq_["ruby development files"]=t
\r
73 +test_begin_subtest "compare thread ids"
\r
76 +$maildir = ENV['MAIL_DIR']
\r
77 +if not $maildir then
\r
78 + abort('environment variable MAIL_DIR must be set')
\r
80 +@db = Notmuch::Database.new($maildir)
\r
81 +@q = @db.query('tag:inbox')
\r
82 +@q.sort = Notmuch::SORT_OLDEST_FIRST
\r
83 +for t in @q.search_threads do
\r
84 + print t.thread_id, "\n"
\r
87 +notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
\r
88 +test_expect_equal_file OUTPUT EXPECTED
\r
90 +test_begin_subtest "compare message ids"
\r
93 +$maildir = ENV['MAIL_DIR']
\r
94 +if not $maildir then
\r
95 + abort('environment variable MAIL_DIR must be set')
\r
97 +@db = Notmuch::Database.new($maildir)
\r
98 +@q = @db.query('tag:inbox')
\r
99 +@q.sort = Notmuch::SORT_OLDEST_FIRST
\r
100 +for m in @q.search_messages do
\r
101 + print m.message_id, "\n"
\r
104 +notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
\r
105 +test_expect_equal_file OUTPUT EXPECTED
\r
107 +test_begin_subtest "get non-existent file"
\r
110 +$maildir = ENV['MAIL_DIR']
\r
111 +if not $maildir then
\r
112 + abort('environment variable MAIL_DIR must be set')
\r
114 +@db = Notmuch::Database.new($maildir)
\r
115 +result = @db.find_message_by_filename('i-dont-exist')
\r
116 +print (result == nil)
\r
118 +test_expect_equal "$(cat OUTPUT)" "true"
\r
120 +test_begin_subtest "count messages"
\r
123 +$maildir = ENV['MAIL_DIR']
\r
124 +if not $maildir then
\r
125 + abort('environment variable MAIL_DIR must be set')
\r
127 +@db = Notmuch::Database.new($maildir)
\r
128 +@q = @db.query('tag:inbox')
\r
129 +print @q.count_messages(),"\n"
\r
131 +notmuch count --output=messages tag:inbox > EXPECTED
\r
132 +test_expect_equal_file OUTPUT EXPECTED
\r
134 +test_begin_subtest "count messages"
\r
137 +$maildir = ENV['MAIL_DIR']
\r
138 +if not $maildir then
\r
139 + abort('environment variable MAIL_DIR must be set')
\r
141 +@db = Notmuch::Database.new($maildir)
\r
142 +@q = @db.query('tag:inbox')
\r
143 +print @q.count_threads(),"\n"
\r
145 +notmuch count --output=threads tag:inbox > EXPECTED
\r
146 +test_expect_equal_file OUTPUT EXPECTED
\r
149 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
150 index 53db9ca..3bbdc03 100644
\r
151 --- a/test/test-lib.sh
\r
152 +++ b/test/test-lib.sh
\r
153 @@ -1156,6 +1156,11 @@ test_python() {
\r
158 + export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
\r
159 + MAIL_DIR=$MAIL_DIR ruby -I $TEST_DIRECTORY/../bindings/ruby> OUTPUT
\r
162 # Creates a script that counts how much time it is executed and calls
\r
163 # notmuch. $notmuch_counter_command is set to the path to the
\r
164 # generated script. Use notmuch_counter_value() function to get the
\r