From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CBbTHYTUm2IjZwAAbAwnHQ (envelope-from ) for ; Sat, 04 Jun 2022 23:54:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id kBSYHYTUm2K6EAAAauVa8A (envelope-from ) for ; Sat, 04 Jun 2022 23:54:12 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (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 D4D2A531D for ; Sat, 4 Jun 2022 23:54:11 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 7A9465F7CA; Sat, 4 Jun 2022 21:54:08 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id A8D3C5F7B9 for ; Sat, 4 Jun 2022 21:54:05 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 9B4125FBD7; Sat, 4 Jun 2022 17:54:04 -0400 (EDT) Received: (nullmailer pid 1311967 invoked by uid 1000); Sat, 04 Jun 2022 21:54:03 -0000 From: David Bremner To: David Bremner , notmuch@notmuchmail.org Subject: [PATCH 1/4] test/sexp: one sided range searches. Date: Sat, 4 Jun 2022 18:53:56 -0300 Message-Id: <20220604215359.1311950-1-david@tethera.net> X-Mailer: git-send-email 2.35.2 In-Reply-To: <87v8v6mpvt.fsf@tethera.net> References: <87v8v6mpvt.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: TYS5M4IJJ5B3KDHIWXV6JSBR3RVDLTUT X-Message-ID-Hash: TYS5M4IJJ5B3KDHIWXV6JSBR3RVDLTUT 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-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1654379652; 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=6qsS1K1HJ/cdtbq7TmBsAnmSp+i4fv+nsLzPzTsWOCc=; b=OKN3NQr2cgF9q5ena9KwdxLxXYfqjuh4YES5dGEPO+3K3zxkCOTlJIc2YvJxqZ5RucXKgu loj7AIB7AGOLfLpDyqyQhGvNWbSI19OsuTyq3emajgSuDKUOznV9BioXgMQMjS8CEE2RXL z4bEKnkCgIqLu0ANsTCcuVdCu4aw17GaNKankWcFDpFHy+M1qm5diSSETps7jHhLFGM0Wu qMGrKcd0r3sA/Eh+TMkibfzJG91RB27CPOoOQq/gmQcqNNE88YEc6B8ZcMd0MU3bu22F58 /kYs+/RPtkMX92LyK3LHJPaZnpMuNu4GlwuV1guLBfec8Oufpo5NWRNOCEEEtg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654379652; a=rsa-sha256; cv=none; b=B4wofkXRbpZ5P4J/7MGjpfZ/dA1fuRqqT7R161zbQcEv4YqRT2rzMlC534qNYc1U3SZu8J 1y1qGDDZBynDOEwsVnBaHr0eT9x9JMI2qQQG8NXeTbPsA6F690ig8I7EU6VWO1n+WVkWWG nJlkz6P77LIXXUPokZPKL1N4H7aRm+gdBpQLEhej1qyNOD5o0rjSNRWGp3Nq0ipKR+p/qd pPrOM/VLuHE6UVg6pVLNJiV+mfIV2/VRGVowwDYJnpGYR5D0PRef03HoUFLozyRNlZn0cV T/Ziz5fRqiKj8jyxn8V8OUPHeQshtG3CULlN484MUR94BfoLFkmKuHx7736d9g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.55 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: D4D2A531D X-Spam-Score: -1.55 X-Migadu-Scanner: scn0.migadu.com X-TUID: Y5WB79F6EQ2E The date range parsing machinery already knows how to do something appropriate with an empty string, but the lastmod parsing blindly tries to parse each atom as a number. --- test/T081-sexpr-search.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/T081-sexpr-search.sh b/test/T081-sexpr-search.sh index da819190..31169fb5 100755 --- a/test/T081-sexpr-search.sh +++ b/test/T081-sexpr-search.sh @@ -854,6 +854,16 @@ notmuch search date:2009-11-17..2009-11-18 and from:keithp | notmuch_search_sani notmuch search --query=sexp '(and (date 2009-11-17 2009-11-18) (from keithp))' | notmuch_search_sanitize > OUTPUT test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "date query, lower bound only" +notmuch search date:2009-11-18.. and from:keithp | notmuch_search_sanitize > EXPECTED +notmuch search --query=sexp '(and (date 2009-11-18 "") (from keithp))' | notmuch_search_sanitize > OUTPUT +test_expect_equal_file_nonempty EXPECTED OUTPUT + +test_begin_subtest "date query, upper bound only" +notmuch search date:..2009-11-17 and from:keithp | notmuch_search_sanitize > EXPECTED +notmuch search --query=sexp '(and (date "" 2009-11-17) (from keithp))' | notmuch_search_sanitize > OUTPUT +test_expect_equal_file_nonempty EXPECTED OUTPUT + test_begin_subtest "date query, illegal nesting 1" notmuch search --query=sexp '(to (date))' > OUTPUT 2>&1 cat < EXPECTED @@ -921,6 +931,18 @@ notmuch search lastmod:$revision..$revision2 | notmuch_search_sanitize > EXPECTE notmuch search --query=sexp "(and (lastmod $revision $revision2))" | notmuch_search_sanitize > OUTPUT test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "lastmod query, lower bound only" +test_subtest_known_broken +notmuch search lastmod:$revision.. | notmuch_search_sanitize > EXPECTED +notmuch search --query=sexp "(lastmod $revision \"\")" | notmuch_search_sanitize > OUTPUT +test_expect_equal_file_nonempty EXPECTED OUTPUT + +test_begin_subtest "lastmod query, upper bound only" +test_subtest_known_broken +notmuch search lastmod:..$revision2 | notmuch_search_sanitize > EXPECTED +notmuch search --query=sexp "(lastmod \"\" $revision2)" | notmuch_search_sanitize > OUTPUT +test_expect_equal_file_nonempty EXPECTED OUTPUT + test_begin_subtest "lastmod query, illegal nesting 1" notmuch search --query=sexp '(to (lastmod))' > OUTPUT 2>&1 cat < EXPECTED -- 2.35.2