From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0r.migadu.com with LMTPS id iMDwKrtCjWCsYwEALuJCtg (envelope-from ) for ; Sat, 01 May 2021 13:59:55 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 6+OIJrtCjWAVdAAAbx9fmQ (envelope-from ) for ; Sat, 01 May 2021 11:59:55 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 07A6E10C8A for ; Sat, 1 May 2021 13:59:55 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 548EA271F5; Sat, 1 May 2021 07:59:45 -0400 (EDT) Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by mail.notmuchmail.org (Postfix) with ESMTPS id 739DF271E8 for ; Sat, 1 May 2021 07:59:34 -0400 (EDT) Received: by mail-ot1-x331.google.com with SMTP id 92-20020a9d02e50000b029028fcc3d2c9eso953839otl.0 for ; Sat, 01 May 2021 04:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=neGakuqYQIVpyaCsoiZKk9sz+WCcIBSluJ6k4Wdy2RM=; b=r+yA4APf92lRA7sM4fa0QcnK6XSQnI1EkfKMc7YRYN3iNqXaB9zeyedXs6piMwhxC4 CLUmSYHYfRPtKjhDNunpHb9V3z/tQ1KOvonxar3Mao0aIs5hOp0S/Kj74D+RYKu30EqI oF9C1pPFcGiZ4Kx4aMB/HLCBWrDu8zO7yHPlKwVw1AVDriHY1ls2+Ij0rJu+h6ZGmRkN zZ1CY70cx1+7AW9H8jKptWKWhL4Q1zLlyOlNXXbkjVixN/bgld2z0ouFyLeD16uWJCRV NZX7eNNmq1TsMkmRC1lrFtl4xaZU25PI4d+CfZcZ7twBPYBNUGrMgLhYtLrK7kAn9WVA zT6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=neGakuqYQIVpyaCsoiZKk9sz+WCcIBSluJ6k4Wdy2RM=; b=SRmSBVLS5vfDyW8MaEMc0WppekgxONCbbcuvuHlSo8tr1fTsRNtFbsE+VELeZvboAB oIn0VPZG/9toXldB+A7rFG89wr9fVW/i9xwKQxBMuc1UqH6LaytTF8uLIfDDutQ3GpeO CDDUxgaNIh2y0xGhaXzHSh0ZnFvg1FqpwefhKUZv6dItF7O1H2NO3zHfCwr4Ra0mJ/rv Pp/nxdIUf4Np4R3l0Vd7EMX1s0zhBcHHVon8EZ1MDQ1RWv/q+OohmhEZOa2Qb7RiPgZu YYP/NPPSS+zfxVASkMmIja8yaFYTFKMxOA/bg0Bta2DE+puLvoG3rK9qTGZ9hu98B7nH zDgw== X-Gm-Message-State: AOAM533sJhQlhonbZ7CD2xh5zcFoGZ5lf5Da1PzD/NoHVEUtSXvUfRcA eF6lzm56JeGXbDO5aHJ48Ta93XV5pxwnLQ== X-Google-Smtp-Source: ABdhPJyS5AMwufEuPXH/RV9SVuJ+L318ICeuRkv+KsmiszGNvTrl/j6yXjIKVifo9Ly9Uacbd5gcOQ== X-Received: by 2002:a9d:5a18:: with SMTP id v24mr7731779oth.350.1619870372872; Sat, 01 May 2021 04:59:32 -0700 (PDT) Received: from localhost ([2806:2f0:4060:638f:a2c5:89ff:fe0c:1151]) by smtp.gmail.com with ESMTPSA id i24sm1534054oig.38.2021.05.01.04.59.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 May 2021 04:59:32 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Subject: [PATCH 5/9] test: ruby: simplify test_ruby() Date: Sat, 1 May 2021 06:59:19 -0500 Message-Id: <20210501115923.483816-6-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210501115923.483816-1-felipe.contreras@gmail.com> References: <20210501115923.483816-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Message-ID-Hash: S4VFQJGDO4T75YKIP2TYOZHGSJGD7OSL X-Message-ID-Hash: S4VFQJGDO4T75YKIP2TYOZHGSJGD7OSL X-MailFrom: felipe.contreras@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Daniel Kahn Gillmor , Ludovic LANGE , Tomi Ollila , Stefano Zacchiroli X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1619870395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=gfpnWJAL0fVPlbQhXD4+k4SPklXwFbVmWZClneNP3JU=; b=e11qlVm1qaQTIyztdFjhuWuEXcYdbmtjMhopR4gjM8Nujm+UJHVviNva6kiYCafxqH65kC 4XpYZnww/UANVZyYTvNhVs160Gzqu2kkewyHYmkXpoKb8exe+lr0FykzWm73O/MzYUaiDU DXetgoZL/Zm574rYnGM6Obcglnxpyh3nK0hsG7ZJLeADAWJTK5ZIzoy37FemHho2OhqwUG bEFa6ElhzVeb+8eIsoNW6oNH3JTFTOxHerPYZsZrFqs8yriJZliBgplbcwURt/R5PnqoeI z3ELEHOo4D7vOKbtzcRWDvwXgCbRY8wvHZP1pcNuMupouMG5yNjPfFWc3YIL5g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619870395; a=rsa-sha256; cv=none; b=eQ4zDbNcGFFs5H3RyZGVhRU/kuKOdBuNrH4Dj+OktXOmzS4Yfgs7RUiaj0kC7G6Mc6ElYV CmFc6DEfo0jEPd24i8IhoGc6RGQEKHtyZskTcyGTztN3wKnJ40+bvgMyzqmSl2JSZaQBkt rAFmo9sIwbVGeSPRzCZkLexO35yd7sz+QvoRuGhgu8gK8KqpgZm+H1Me0YMyKoSBM8mmnd 3XuTG36VXbdQAqKsQeC0kbgFp6dbrSbqLRM31n/VeNycju+d7CNJXgXvikqUb/VyCDXcVJ R7toSZjBnJE2ZyfWzioL5mt5xXDR/Oz3EFADpH+fd958UXAJIClY2hAKAK73ug== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=r+yA4APf; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.00 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=r+yA4APf; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 07A6E10C8A X-Spam-Score: -1.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: l6q9vF4RZdaC 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 -- 2.31.0