mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
test: ruby: simplify test_ruby()
We always do test_expect_equal_file, so do it in test_ruby() directly. The only subtest where we don't (get non-existent file) can be easily modified. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
parent
9f6bc01824
commit
2dbc5fdf5a
1 changed files with 7 additions and 11 deletions
|
@ -16,9 +16,11 @@ test_ruby() {
|
||||||
EOF
|
EOF
|
||||||
cat
|
cat
|
||||||
) | $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT
|
) | $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
}
|
}
|
||||||
|
|
||||||
test_begin_subtest "compare thread ids"
|
test_begin_subtest "compare thread ids"
|
||||||
|
notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
|
||||||
test_ruby <<"EOF"
|
test_ruby <<"EOF"
|
||||||
@q = @db.query('tag:inbox')
|
@q = @db.query('tag:inbox')
|
||||||
@q.sort = Notmuch::SORT_OLDEST_FIRST
|
@q.sort = Notmuch::SORT_OLDEST_FIRST
|
||||||
|
@ -26,10 +28,9 @@ for t in @q.search_threads do
|
||||||
print t.thread_id, "\n"
|
print t.thread_id, "\n"
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
|
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
|
||||||
|
|
||||||
test_begin_subtest "compare message ids"
|
test_begin_subtest "compare message ids"
|
||||||
|
notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
|
||||||
test_ruby <<"EOF"
|
test_ruby <<"EOF"
|
||||||
@q = @db.query('tag:inbox')
|
@q = @db.query('tag:inbox')
|
||||||
@q.sort = Notmuch::SORT_OLDEST_FIRST
|
@q.sort = Notmuch::SORT_OLDEST_FIRST
|
||||||
|
@ -37,40 +38,35 @@ for m in @q.search_messages do
|
||||||
print m.message_id, "\n"
|
print m.message_id, "\n"
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
|
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
|
||||||
|
|
||||||
test_begin_subtest "get non-existent file"
|
test_begin_subtest "get non-existent file"
|
||||||
|
echo -n true > EXPECTED
|
||||||
test_ruby <<"EOF"
|
test_ruby <<"EOF"
|
||||||
result = @db.find_message_by_filename('i-dont-exist')
|
result = @db.find_message_by_filename('i-dont-exist')
|
||||||
print (result == nil)
|
print (result == nil)
|
||||||
EOF
|
EOF
|
||||||
test_expect_equal "$(cat OUTPUT)" "true"
|
|
||||||
|
|
||||||
test_begin_subtest "count messages"
|
test_begin_subtest "count messages"
|
||||||
|
notmuch count --output=messages tag:inbox > EXPECTED
|
||||||
test_ruby <<"EOF"
|
test_ruby <<"EOF"
|
||||||
@q = @db.query('tag:inbox')
|
@q = @db.query('tag:inbox')
|
||||||
print @q.count_messages(),"\n"
|
print @q.count_messages(),"\n"
|
||||||
EOF
|
EOF
|
||||||
notmuch count --output=messages tag:inbox > EXPECTED
|
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
|
||||||
|
|
||||||
test_begin_subtest "count threads"
|
test_begin_subtest "count threads"
|
||||||
|
notmuch count --output=threads tag:inbox > EXPECTED
|
||||||
test_ruby <<"EOF"
|
test_ruby <<"EOF"
|
||||||
@q = @db.query('tag:inbox')
|
@q = @db.query('tag:inbox')
|
||||||
print @q.count_threads(),"\n"
|
print @q.count_threads(),"\n"
|
||||||
EOF
|
EOF
|
||||||
notmuch count --output=threads tag:inbox > EXPECTED
|
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
|
||||||
|
|
||||||
test_begin_subtest "get all tags"
|
test_begin_subtest "get all tags"
|
||||||
|
notmuch search --output=tags '*' > EXPECTED
|
||||||
test_ruby <<"EOF"
|
test_ruby <<"EOF"
|
||||||
@t = @db.all_tags()
|
@t = @db.all_tags()
|
||||||
for tag in @t do
|
for tag in @t do
|
||||||
print tag,"\n"
|
print tag,"\n"
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
notmuch search --output=tags '*' > EXPECTED
|
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Reference in a new issue