mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
test: ruby: use much more standard Ruby idioms
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
parent
63413a5563
commit
c4b23cf29a
1 changed files with 8 additions and 12 deletions
|
@ -24,7 +24,7 @@ notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread://
|
||||||
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
|
||||||
for t in @q.search_threads do
|
@q.search_threads.each do |t|
|
||||||
puts t.thread_id
|
puts t.thread_id
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
|
@ -34,38 +34,34 @@ notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// >
|
||||||
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
|
||||||
for m in @q.search_messages do
|
@q.search_messages.each do |m|
|
||||||
puts m.message_id
|
puts m.message_id
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_begin_subtest "get non-existent file"
|
test_begin_subtest "get non-existent file"
|
||||||
echo true > EXPECTED
|
echo nil > EXPECTED
|
||||||
test_ruby <<"EOF"
|
test_ruby <<"EOF"
|
||||||
result = @db.find_message_by_filename('i-dont-exist')
|
p @db.find_message_by_filename('i-dont-exist')
|
||||||
puts (result == nil)
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_begin_subtest "count messages"
|
test_begin_subtest "count messages"
|
||||||
notmuch count --output=messages tag:inbox > EXPECTED
|
notmuch count --output=messages tag:inbox > EXPECTED
|
||||||
test_ruby <<"EOF"
|
test_ruby <<"EOF"
|
||||||
@q = @db.query('tag:inbox')
|
puts @db.query('tag:inbox').count_messages()
|
||||||
puts @q.count_messages()
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_begin_subtest "count threads"
|
test_begin_subtest "count threads"
|
||||||
notmuch count --output=threads tag:inbox > EXPECTED
|
notmuch count --output=threads tag:inbox > EXPECTED
|
||||||
test_ruby <<"EOF"
|
test_ruby <<"EOF"
|
||||||
@q = @db.query('tag:inbox')
|
puts @db.query('tag:inbox').count_threads()
|
||||||
puts @q.count_threads()
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_begin_subtest "get all tags"
|
test_begin_subtest "get all tags"
|
||||||
notmuch search --output=tags '*' > EXPECTED
|
notmuch search --output=tags '*' > EXPECTED
|
||||||
test_ruby <<"EOF"
|
test_ruby <<"EOF"
|
||||||
@t = @db.all_tags()
|
@db.all_tags.each do |tag|
|
||||||
for tag in @t do
|
puts tag
|
||||||
puts tag
|
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue