From 2dbc5fdf5a3c40b3e44dcde7d8caffe7dbbd217f Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sat, 1 May 2021 06:59:19 -0500 Subject: [PATCH] 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 --- test/T395-ruby.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh index 67d6e205..55bf4c2b 100755 --- a/test/T395-ruby.sh +++ b/test/T395-ruby.sh @@ -16,9 +16,11 @@ test_ruby() { EOF cat ) | $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> 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 test_ruby <<"EOF" @q = @db.query('tag:inbox') @q.sort = Notmuch::SORT_OLDEST_FIRST @@ -26,10 +28,9 @@ for t in @q.search_threads do print t.thread_id, "\n" end 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" +notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED test_ruby <<"EOF" @q = @db.query('tag:inbox') @q.sort = Notmuch::SORT_OLDEST_FIRST @@ -37,40 +38,35 @@ for m in @q.search_messages do print m.message_id, "\n" end 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" +echo -n true > EXPECTED test_ruby <<"EOF" result = @db.find_message_by_filename('i-dont-exist') print (result == nil) EOF -test_expect_equal "$(cat OUTPUT)" "true" test_begin_subtest "count messages" +notmuch count --output=messages tag:inbox > EXPECTED test_ruby <<"EOF" @q = @db.query('tag:inbox') print @q.count_messages(),"\n" EOF -notmuch count --output=messages tag:inbox > EXPECTED -test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "count threads" +notmuch count --output=threads tag:inbox > EXPECTED test_ruby <<"EOF" @q = @db.query('tag:inbox') print @q.count_threads(),"\n" EOF -notmuch count --output=threads tag:inbox > EXPECTED -test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "get all tags" +notmuch search --output=tags '*' > EXPECTED test_ruby <<"EOF" @t = @db.all_tags() for tag in @t do print tag,"\n" end EOF -notmuch search --output=tags '*' > EXPECTED -test_expect_equal_file EXPECTED OUTPUT test_done