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 > EXPECTED
25 q = db.query('tag:inbox')
26 q.sort = Notmuch::SORT_OLDEST_FIRST
27 q.search_threads.each do |t|
28 puts 'thread:%s' % t.thread_id
32 test_begin_subtest "compare message ids"
33 notmuch search --sort=oldest-first --output=messages tag:inbox > EXPECTED
35 q = db.query('tag:inbox')
36 q.sort = Notmuch::SORT_OLDEST_FIRST
37 q.search_messages.each do |m|
38 puts 'id:%s' % m.message_id
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|
68 notmuch config set search.exclude_tags deleted
69 generate_message '[subject]="Good"'
70 generate_message '[subject]="Bad"' "[in-reply-to]=\<$gen_msg_id\>"
71 notmuch new > /dev/null
72 notmuch tag +deleted id:$gen_msg_id
74 test_begin_subtest "omit excluded all"
75 notmuch search --output=threads --exclude=all tag:inbox > EXPECTED
77 q = db.query('tag:inbox')
78 q.add_tag_exclude('deleted')
79 q.omit_excluded = Notmuch::EXCLUDE_ALL
80 q.search_threads.each do |t|
81 puts 'thread:%s' % t.thread_id
85 test_begin_subtest "check sort argument"
86 notmuch search --sort=oldest-first --output=threads tag:inbox > EXPECTED
88 q = db.query('tag:inbox', sort: Notmuch::SORT_OLDEST_FIRST)
89 q.search_threads.each do |t|
90 puts 'thread:%s' % t.thread_id
94 test_begin_subtest "check exclude_tags argument"
95 notmuch search --output=threads --exclude=all tag:inbox > EXPECTED
97 q = db.query('tag:inbox', exclude_tags: %w[deleted], omit_excluded: Notmuch::EXCLUDE_ALL)
98 q.search_threads.each do |t|
99 puts 'thread:%s' % t.thread_id