From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SJHtJFtl6WH+WgEAgWs5BA (envelope-from ) for ; Thu, 20 Jan 2022 14:36:27 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 2Mh4HVtl6WF14QAAG6o9tA (envelope-from ) for ; Thu, 20 Jan 2022 14:36:27 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1C5742D603 for ; Thu, 20 Jan 2022 14:36:27 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 9672F5F713; Thu, 20 Jan 2022 13:36:14 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 760D25F6D1 for ; Thu, 20 Jan 2022 13:36:12 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id D85435FC03; Thu, 20 Jan 2022 08:36:11 -0500 (EST) Received: (nullmailer pid 31643 invoked by uid 1000); Thu, 20 Jan 2022 13:36:08 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH v2 5/6] test/sexpr-search: add known broken tests for lastmod queries Date: Thu, 20 Jan 2022 09:36:04 -0400 Message-Id: <20220120133605.31401-6-david@tethera.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220120133605.31401-1-david@tethera.net> References: <20220120133605.31401-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: D4UOHFVMQAODYBXPWUHBDDXTKTYYXCXJ X-Message-ID-Hash: D4UOHFVMQAODYBXPWUHBDDXTKTYYXCXJ X-MailFrom: bremner@tethera.net 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; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642685787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to: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-owner:list-unsubscribe:list-subscribe:list-post; bh=zt9up7cjkMzcioPDD4aknkqQkAs+4ScaLly4Cy8R9/k=; b=hfZ0P5k0UVQXdIe3p6bjVx8xIMkMCTUcyOL668ZTp7VsSHMChx5OiJytsZFqH87Jxyw+1Q 2S+89z6IdOA9JiNqqhH5ndpmDGwGvv6oM4Oop7YBASuNr1+eylvKlGHEECvVsaBhjek6T6 eH5XPorxRVPR6c6hVm/Ug5gqWDe2JqBDo12pHP1ecdbNFrA6C/mZrtLSRltA50yA27iI5w xDV/sL1P54SgZpMajDwWPX1ERP5CEykg5etHo8/E6jEkFMMEOJct3YUcRDX/07DJkNmxfV YpMCPKdggbfYqHxUxcL9IXzPxDRmuiR4w2WS4qzoEX1KMbtYIT3sXGAH2SD8pg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642685787; a=rsa-sha256; cv=none; b=ZKcadpGrT9RgmzudFub/sBbCAcbQWTlG5repDP9nJkcNrvoZe0mkXgYmamTf0v75vHc2rM yBeLWNpFwKOfAoEJ48oIZym/t1iz1IyXI76xMXX5MR53L24iz/Z0rNiBRg2vQLikkpxdF3 Ec00soa5bZETJtXIfKqpN1wqRfqqgrtcZx5s+wKEHN257MzFCuA6aSQ7iKb8dL8LINbQ6K AHetQXSLu5g2T7rJOiEwLtDlUgv5WTHtvgvdnbPsO84PMBMssdJe34vt6u+A0Qt+rNaVda 8FW0DLLwifMKnGSpWeP/4d7hRKfgCS1kB4k+GPQcpTV0H7JfDzEpaUGiNue7tQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.35 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 1C5742D603 X-Spam-Score: -1.35 X-Migadu-Scanner: scn1.migadu.com X-TUID: eOnb6o2w9zUU These are loosely modelled on the tests just above for date ranges, since the error conditions are similar. Some ideas also borrowed from T570-revision-tracking. --- test/T081-sexpr-search.sh | 85 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/test/T081-sexpr-search.sh b/test/T081-sexpr-search.sh index 32b30493..4231dd38 100755 --- a/test/T081-sexpr-search.sh +++ b/test/T081-sexpr-search.sh @@ -831,6 +831,91 @@ Didn't understand date specification 'hawaiian-pizza-day' EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "lastmod query, empty" +test_subtest_known_broken +notmuch search from:keithp | notmuch_search_sanitize > EXPECTED +notmuch search --query=sexp '(and (lastmod) (from keithp))'| notmuch_search_sanitize > OUTPUT +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "lastmod query, one argument" +test_subtest_known_broken +notmuch tag +4EFC743A.3060609@april.org id:4EFC743A.3060609@april.org +revision=$(notmuch count --lastmod '*' | cut -f3) +notmuch search lastmod:$revision..$revision | notmuch_search_sanitize > EXPECTED +notmuch search --query=sexp "(and (lastmod $revision))" | notmuch_search_sanitize > OUTPUT +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "lastmod query, two arguments" +test_subtest_known_broken +notmuch tag +keithp from:keithp +revision2=$(notmuch count --lastmod '*' | cut -f3) +notmuch search lastmod:$revision..$revision2 | notmuch_search_sanitize > EXPECTED +notmuch search --query=sexp "(and (lastmod $revision $revision2))" | notmuch_search_sanitize > OUTPUT +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "lastmod query, illegal nesting 1" +test_subtest_known_broken +notmuch search --query=sexp '(to (lastmod))' > OUTPUT 2>&1 +cat < EXPECTED +notmuch search: Syntax error in query +nested field: 'lastmod' inside 'to' +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "lastmod query, bad from revision" +test_subtest_known_broken +notmuch search --query=sexp '(lastmod apples)' > OUTPUT 2>&1 +cat < EXPECTED +notmuch search: Syntax error in query +bad 'from' revision: 'apples' +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "lastmod query, bad to revision" +test_subtest_known_broken +notmuch search --query=sexp '(lastmod 0 apples)' > OUTPUT 2>&1 +cat < EXPECTED +notmuch search: Syntax error in query +bad 'to' revision: 'apples' +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "lastmod query, illegal nesting 2" +test_subtest_known_broken +notmuch search --query=sexp '(to (lastmod 2021-11-18))' > OUTPUT 2>&1 +cat < EXPECTED +notmuch search: Syntax error in query +nested field: 'lastmod' inside 'to' +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "lastmod query, illegal nesting 3" +test_subtest_known_broken +notmuch search --query=sexp '(lastmod (to))' > OUTPUT 2>&1 +cat < EXPECTED +notmuch search: Syntax error in query +expected atom as first argument of 'lastmod' +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "lastmod query, illegal nesting 4" +test_subtest_known_broken +notmuch search --query=sexp '(lastmod today (to))' > OUTPUT 2>&1 +cat < EXPECTED +notmuch search: Syntax error in query +expected atom as second argument of 'lastmod' +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "lastmod query, too many arguments" +test_subtest_known_broken +notmuch search --query=sexp '(lastmod yesterday and tommorow)' > OUTPUT 2>&1 +cat < EXPECTED +notmuch search: Syntax error in query +'lastmod' expects maximum of two arguments +EOF +test_expect_equal_file EXPECTED OUTPUT + test_begin_subtest "user header (unknown header)" notmuch search --query=sexp '(FooBar)' >& OUTPUT cat < EXPECTED -- 2.34.1