X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2FT395-ruby.sh;h=a0b76eb89ca1ba1da02c861a39f1e280105dbaf6;hp=301681092471e0e47f176cdb20cdeaeb8412378f;hb=HEAD;hpb=faf5511c3e343c3a652df664a0f7b4bd60f3bdaa diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh index 30168109..d0c6bb17 100755 --- a/test/T395-ruby.sh +++ b/test/T395-ruby.sh @@ -2,7 +2,7 @@ test_description="ruby bindings" . $(dirname "$0")/test-lib.sh || exit 1 -if [ "${NOTMUCH_HAVE_RUBY_DEV}" = "0" ]; then +if [ -z "${NOTMUCH_TEST_INSTALLED-}" -a "${NOTMUCH_HAVE_RUBY_DEV-0}" = "0" ]; then test_subtest_missing_external_prereq_["ruby development files"]=t fi @@ -12,30 +12,34 @@ test_ruby() { ( cat <<-EOF require 'notmuch' - db = Notmuch::Database.new('$MAIL_DIR') + db = Notmuch::Database.new() EOF cat - ) | $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT + ) | if [ -n "${NOTMUCH_TEST_INSTALLED-}" ]; then + ruby + else + $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby" + fi> OUTPUT test_expect_equal_file EXPECTED OUTPUT } test_begin_subtest "compare thread ids" -notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED +notmuch search --sort=oldest-first --output=threads tag:inbox > EXPECTED test_ruby <<"EOF" q = db.query('tag:inbox') q.sort = Notmuch::SORT_OLDEST_FIRST q.search_threads.each do |t| - puts t.thread_id + puts 'thread:%s' % t.thread_id end EOF test_begin_subtest "compare message ids" -notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED +notmuch search --sort=oldest-first --output=messages tag:inbox > EXPECTED test_ruby <<"EOF" q = db.query('tag:inbox') q.sort = Notmuch::SORT_OLDEST_FIRST q.search_messages.each do |m| - puts m.message_id + puts 'id:%s' % m.message_id end EOF @@ -65,4 +69,39 @@ db.all_tags.each do |tag| end EOF +notmuch config set search.exclude_tags deleted +generate_message '[subject]="Good"' +generate_message '[subject]="Bad"' "[in-reply-to]=\<$gen_msg_id\>" +notmuch new > /dev/null +notmuch tag +deleted id:$gen_msg_id + +test_begin_subtest "omit excluded all" +notmuch search --output=threads --exclude=all tag:inbox > EXPECTED +test_ruby <<"EOF" +q = db.query('tag:inbox') +q.add_tag_exclude('deleted') +q.omit_excluded = Notmuch::EXCLUDE_ALL +q.search_threads.each do |t| + puts 'thread:%s' % t.thread_id +end +EOF + +test_begin_subtest "check sort argument" +notmuch search --sort=oldest-first --output=threads tag:inbox > EXPECTED +test_ruby <<"EOF" +q = db.query('tag:inbox', sort: Notmuch::SORT_OLDEST_FIRST) +q.search_threads.each do |t| + puts 'thread:%s' % t.thread_id +end +EOF + +test_begin_subtest "check exclude_tags argument" +notmuch search --output=threads --exclude=all tag:inbox > EXPECTED +test_ruby <<"EOF" +q = db.query('tag:inbox', exclude_tags: %w[deleted], omit_excluded: Notmuch::EXCLUDE_ALL) +q.search_threads.each do |t| + puts 'thread:%s' % t.thread_id +end +EOF + test_done