From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 6Bf8DToNkGK3BAAAbAwnHQ (envelope-from ) for ; Fri, 27 May 2022 01:28:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MCviDToNkGI3BQAAauVa8A (envelope-from ) for ; Fri, 27 May 2022 01:28:58 +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 85B831AB94 for ; Fri, 27 May 2022 01:28:57 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id A210D5F78D; Thu, 26 May 2022 23:28:54 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id CABB15F782 for ; Thu, 26 May 2022 23:28:51 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id AFA915FBD7; Thu, 26 May 2022 19:28:50 -0400 (EDT) Received: (nullmailer pid 672205 invoked by uid 1000); Thu, 26 May 2022 23:28:49 -0000 From: David Bremner To: Leo Okawa Ericson , notmuch@notmuchmail.org Subject: Re: [PATCH v3] emacs: Make notmuch-show-next-thread return nil on failure In-Reply-To: <20220505085605.8224-1-git@relevant-information.com> References: <20220505085605.8224-1-git@relevant-information.com> Date: Thu, 26 May 2022 20:28:49 -0300 Message-ID: <874k1b6fgu.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: KXKSDLCPBIMU6APUCML2SZKADX2EE4ZF X-Message-ID-Hash: KXKSDLCPBIMU6APUCML2SZKADX2EE4ZF X-MailFrom: david@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=1653607737; 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=iOHZKPnafggBX1VR9OtZdOB4A3dKCDucryKnFafCcYU=; b=cHLphqMAMK4dHBEafLMYurbDcZwIvp0aVQlumC5X4U8BBxvLV23ZpsuQFvP6d2QvaGh0oF l1K0LtiLQTXYZAOM5xgubJsrtUwLC9fykcdMGmMY6eYqGhThdBkjOkfQsV7a5PJ8XHjevf 7qQdJP94TmudHCP9oyTphpSCsvgRtYBPl988uTTAZ+pNWXFUAzul8Uz/SzPbLSJuIbmVk2 J43Cm7X99Tq8KGS6v3KASibBousPwaAr240OPtMEi/cLSE+n7Gfd7e3IJn+Cr9xYiZBkKQ 6F1nUCsfF7qlxaXDfZeI1b6j5GtUePnbqB3u3q0dYdALasnYrp8YMcIaBNHyqw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653607737; a=rsa-sha256; cv=none; b=H4pycIJD4mOY1BnAJ9xZBgZsVtbZEwgTftmHCPc/QJ5cfShj/a6rCtMKTI0xiRcYvZ+ZAF 1fcO+yIHce8X6YfZH4S6Q2Wr3NVZDkRN8PJ9znBrL9QGgWsTbwcc+wroP3lRj6NQ6PN9hY XlIOUsEL8iaP/AOQrjbSDeL8qJo81LOYXLITwApdCy2XNhTylMzR2MpAyxYoGPTZkhS4sz lRPMVq0kMM6GZH4QlgRbMd7Sg2cDHt9Wf0rJAtV9GE3v82J12RlYBZLj/QzHAa35YKIKrC Qv9wa8RxigZ8GarfPE9nRyp/ecYM9Sgfj6JazDm95ays9ar8krpHMofq4Y5+pQ== 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: -3.02 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: 85B831AB94 X-Spam-Score: -3.02 X-Migadu-Scanner: scn0.migadu.com X-TUID: ZOQELme2njEm Leo Okawa Ericson writes: > +test_begin_subtest "notmuch-search-show-thread returns non-nil on success" > +test_emacs_expect_t '(notmuch-search "id:20091117203301.GV3165@dottiness.seas.harvard.edu") > + (when (notmuch-search-show-thread) > + (error "Expected non-nil when successfully showing a thread")) > + (when (notmuch-show-next-thread) > + (error "Expected nil when there are no more threads")) > + t' > + > +test_begin_subtest "notmuch-show-next-thread returns non-nil on success" > +test_emacs_expect_t '(notmuch-search "id:20091117203301.GV3165@dottiness.seas.harvard.edu") > + (when (notmuch-show-next-thread) > + (error "Expected non-nil when successfully showing a thread")) > + (when (notmuch-show-next-thread) > + (error "Expected nil when there are no more threads")) > + t)' > + - There are some whitespace issues that git complains about (space before tab). That seems fixable with a judicious application of M-x tabify. There is also an extra space after test_emacs_expect_t. - The tests look like there there is some over enthusiastic copy pasting, since both test both functions, which makes them duplicate tests. - Not sure why you need to throw errors here, can't you just return t or nil? - the logic of the "when" does not seem to match the string for the error. Are you expecting the function calls to succeed or not? d