2 test_description="ruby bindings"
3 . $(dirname "$0")/test-lib.sh || exit 1
5 if [ "${NOTMUCH_HAVE_RUBY_DEV}" = "0" ]; then
6 test_subtest_missing_external_prereq_["ruby development files"]=t
15 @db = Notmuch::Database.new('$MAIL_DIR')
18 ) | $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT
19 test_expect_equal_file EXPECTED OUTPUT
22 test_begin_subtest "compare thread ids"
23 notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
25 @q = @db.query('tag:inbox')
26 @q.sort = Notmuch::SORT_OLDEST_FIRST
27 @q.search_threads.each do |t|
32 test_begin_subtest "compare message ids"
33 notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
35 @q = @db.query('tag:inbox')
36 @q.sort = Notmuch::SORT_OLDEST_FIRST
37 @q.search_messages.each do |m|
42 test_begin_subtest "get non-existent file"
45 p @db.find_message_by_filename('i-dont-exist')
48 test_begin_subtest "count messages"
49 notmuch count --output=messages tag:inbox > EXPECTED
51 puts @db.query('tag:inbox').count_messages()
54 test_begin_subtest "count threads"
55 notmuch count --output=threads tag:inbox > EXPECTED
57 puts @db.query('tag:inbox').count_threads()
60 test_begin_subtest "get all tags"
61 notmuch search --output=tags '*' > EXPECTED
63 @db.all_tags.each do |tag|