From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 4M9xAbZhtWRkdwEASxT56A (envelope-from ) for ; Mon, 17 Jul 2023 17:43:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id YCOtAbZhtWRxfAEA9RJhRA (envelope-from ) for ; Mon, 17 Jul 2023 17:43:50 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 880E73DCDA for ; Mon, 17 Jul 2023 17:43:49 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=e7ve39JN; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=outlook.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1689608629; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=lXuLVQ85TSwUW9TnpXyhULWA7vcb3IFz5syIwArtHxc=; b=IuO/1W1k6zJNkuLF2hTfseuzFo/uHRN9BtLjrCtCbwZ4mqH7XQITof/tlltf+UD1citPgL Cv9NMJhccyoHCTjcS+GuAYyiCsfN0ep0ZgVRDNr9E+4fmhRATYe6IBAmWDikoaVeUmc/7D lEDhb4XJMNGyi/3atKpDE8iUo5NljJtl0MCiLrOqJEcbnjOacDKQDDaqgG3MydRX9XUhQC 8CvOWjM3z8LjTakc+9AUr2L/QEEgrLJUnUUD+bRYGnY2LWw6qS//+5+2NK1Xy82dqKTtSy K9xirYhjf+crYSukHh+UqtLl1f0DGLL0l1Ttk4uJoyLYVR2M6Cx4WTQexxkLEA== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1689608629; a=rsa-sha256; cv=pass; b=inP9ct2saIvtU3r67arNO5VZMXmPcuX8/IhPxJOiooD3c8uy6EIHwtnGRWZsAzA0ZqNOvt k8cQVcR8t7Mh4qhMOnQbWKKTlxcZPhfUCdfAIWtfDe5Vp/AORkdGgqSTEPkMdc90W45dPT yfwl/qJlVtlEmQGJndm4+NtVfTfBotYhH8iyE++9taNoG3wVYMUTNui0bJUUtHU+wYVoRU ZcQr9aWS0QnJt5wwOMz12lW8BTIYzXMPmKXBzOw+QgW05lxCCnQody+Z3RW9XVlEDIut8Q CsOuVmm1L/vkfkBCLh37TtBzmtpo+XUdfNGGYpq8wTu9aboVXIyVgTf+ANjpHQ== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=outlook.com header.s=selector1 header.b=e7ve39JN; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=outlook.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qLQNL-0003b3-HU; Mon, 17 Jul 2023 11:43:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qLQNJ-0003Wx-2a for emacs-orgmode@gnu.org; Mon, 17 Jul 2023 11:43:01 -0400 Received: from mail-dm6nam10olkn20827.outbound.protection.outlook.com ([2a01:111:f400:7e88::827] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qLQNF-0008Nl-UX for emacs-orgmode@gnu.org; Mon, 17 Jul 2023 11:43:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BjAKd8WMf9UNsvzOmnC00sw5R9maKmPp6vJMIyJOvcfVp2D6FbTvfOgHPNYmUS5jPP/eB5ftCiMS09EE5SGoWTMCJzFKoXDSiZYTyXfzgu8/kYjxF1yuYtwhJ/6fmtYis+erklKjObiftk6QdksS5QFA95H7gbbFWCLXCsRRAR8GkjDT2JUB5tQTf3XQnwETpY6/w+QE90oJ/v2BZz3CM8hD3l+TOh9IauRq6T067rXbh/9HBzFPPS1OgONkRO4X2dtT5O2LrQu6Jx7xgogZUzzxx/GDAZ25CscKOO+1ybmxd9oDsA5LCNEPvWhLhdyKOivwO2RSzX5Hb9XOVo7xhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lXuLVQ85TSwUW9TnpXyhULWA7vcb3IFz5syIwArtHxc=; b=DAkgPVN8qDXuizQxYdX0m9ciA4RfnXfqFcm0ldSzjimX4H9nqtW2GO3c1u+aRYeKRJjtX3F7em9iwpSRzoljBmtGdjTwhzMqUWWKrZ7NNnFlePuZQi3vCZrobQcaHXULakWjfUjHUKvF7fpDh/I/9PGa77OTJS0OZDVkoJPKVdGpEJZP8gTS1dO50BOjpLviip2w0F4x52PUFelt4CD25v5/CrEuiA1qA1sapyRbRM0/cOkVmnvRH2oKjmWxFO3VEC6QR20evAhf89L9AoTq/qANNNPTrNf3TgdhVVBvABLeIX9C+NyqTzQdzAaD2VTzWcgBcBRgoniqtOfgjR7JqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lXuLVQ85TSwUW9TnpXyhULWA7vcb3IFz5syIwArtHxc=; b=e7ve39JNl4jq4P8sHdEd4G61YSf7maebwVESz2TgKg5g8oDSEAlBs3ZRE90IqovOC5hF7eEVwBJBpP5pzNyA7qXwE2jEWcqvFDzZZD1IeLZaKIZ2PxCg4w5ZmZOy2AD3vfwt8i2TRZPYprttuo9Fbw3BguXXBj3KogmKa1f01lxuoU5c/hmEUQGhnUFUq87QGImkgZSSXeB4qPbSSRHJyI/oahPPTUTJJXD+UN9FHF1v7HPZKYd1Mlds12dAbVacLZFUkYGMJPNiLedQk61YA9kdCvSzArYdg3F8Ygp9y4SXsLQLnhF/0Dg6qzz3f8+TOaEz5/14hAfy2bSUdiOHig== Received: from DM5PR03MB3163.namprd03.prod.outlook.com (2603:10b6:4:40::24) by SA1PR03MB6417.namprd03.prod.outlook.com (2603:10b6:806:1c0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Mon, 17 Jul 2023 15:37:52 +0000 Received: from DM5PR03MB3163.namprd03.prod.outlook.com ([fe80::b2fc:59fe:bb07:4d95]) by DM5PR03MB3163.namprd03.prod.outlook.com ([fe80::b2fc:59fe:bb07:4d95%4]) with mapi id 15.20.6588.031; Mon, 17 Jul 2023 15:37:52 +0000 From: Morgan Smith To: emacs-orgmode@gnu.org Subject: [PATCH] Testing: Add tests for 'org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item' Date: Mon, 17 Jul 2023 11:37:44 -0400 Message-ID: X-Mailer: git-send-email 2.41.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [jRZWyGZJ8YFZAMlG6mMlReAi7Jv9gsJ8] X-ClientProxiedBy: YT4PR01CA0332.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:10a::6) To DM5PR03MB3163.namprd03.prod.outlook.com (2603:10b6:4:40::24) X-Microsoft-Original-Message-ID: <20230717153743.17655-2-Morgan.J.Smith@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR03MB3163:EE_|SA1PR03MB6417:EE_ X-MS-Office365-Filtering-Correlation-Id: 400220a9-bea1-4dad-c389-08db86dbc872 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9FCqDNaV26pIIk+gdYS4LswvXHpnYJb4pwCSfenK+4ogEGFP8O37MiWQZMxMbuNeGBwXeOhVPT5ci/wBwYf7eDXEz1Xml5cbGoS9ipVFYyKzRlWS+X7+g2aRzslihWL6JU+Atxz4TBPzDxuXqfwNp0xxva2PWMh/QHw0iRedF8DqkXLqN4Iwr4x80k/ALC4LGYsJA71fWxRem5A8QKSeEtNbMV7tukhbTFFoNFalrAl4BRFcxMF4AWKTdBlleHgcnXfAA6GG+Wq7YjBwLY5BbEhfAOL2M++EkVbT5tzOzQPjcIWtWB05Nqo5wMRZ+3kzjPTca7i+50B+yQ8l9+W/KacfbAdELos6av1xxhFr7P4sMx52UHgaOG3vMNO96SE1igqI1VO5moRvFhQNhteeJ4nJQIT2c1i99MB+mKzPDcIVKF2xDtJ8xA/8a5lByOm4mIJL/T0Fsf22AifCqrxq8GRlLzlJOTWNl0QGtuFH5Abkr9mHnID6vItHzR8TlvD+y9t1q7cu1D5t/xEyVZSr2Wys+nYDCbEmeUYRgvJ02o4mIB3SFE/N/G/FWEU43Z8y X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Ad6bMXBNotAilIqnrTbBVZEhNekRqfKb4rlggXgSocZZD+m4oOG6g+/X/cPk?= =?us-ascii?Q?OPs5ImgEtDHAJjm4biHuxn3hZY7cVEpWk/rq1ajBpNEUn0oLoyMfFsB9puem?= =?us-ascii?Q?qus6uKe9unDRsn8DlA2RZeng3ynZ4/wPzM5d/Fv/jHTO3nG9D6JZJNMrMSVT?= =?us-ascii?Q?e8QXIxKjl1UN0TAC0TUyzaMrgIRqsHhDLQpQh/M7SM1gIe9a+F5aVGa2UAqZ?= =?us-ascii?Q?bcVWYPQCuS3d73gusarhsawNJFoDdSCP6IECjw53q+gzxjINZ9SQPF+pmBYq?= =?us-ascii?Q?4oFodyokyF2vGClOuUKuhnPp6PFoY+rX8/gapzjRQdFxh7NPSHlmt/gZoCRT?= =?us-ascii?Q?sg43gfjJBd5m8JWqpOcr82yhqaO+kvpAkjy9Lv0ZnUHnedeqcKlFfXy2oA+Q?= =?us-ascii?Q?GPTt5TCA9rjsUUsZqaevRmf3tAnZ0Aa7wAgOxEeKS4hYXja3oZ8W+rsWLXnj?= =?us-ascii?Q?axWtP5gvFpf62QeNrow5pq6Gh3obyuQoePZZq1cL7lczqfkQ6bWPf1hPSleq?= =?us-ascii?Q?ky0jRK91yG66P3BjDM3OMig+XLnOvmeJIkVzNmL7LKkHAy9ox0Al+wSxzU8e?= =?us-ascii?Q?gtQJI8vbmpZO6woqz3Ib3Qp7yz5qVqXLbJVDJTCnBmLeSfFbZkZGv4nN/eDG?= =?us-ascii?Q?rKKdk6CvOE24zye72yDchtb986txHjFmYYjy4xMGEVrlIlUK4SsYnzjgN6sl?= =?us-ascii?Q?lEeahG/yGCiLSxdY6cPqGQB9sY8i50ef/ajoVgw97ie/92HW4hLtKysgmNgg?= =?us-ascii?Q?O5uqDD6SqfWXQFuHyS4rcibZEuVJ4A9PnLbf6qmVQ6DMibW+hDM+SbZOpgyn?= =?us-ascii?Q?0NXGpn3xxl53UW+eVpS63YYL7GUiKjPgL8Z4fRYZ792lpBSzP9PG/J+x0PZT?= =?us-ascii?Q?WXl6vrnrKj3cS7QrpX7HoyjnCqBjMn5GZLxq0rIvPDYEhaKObBDb6eK6LHOY?= =?us-ascii?Q?5i6Q0x/EThnrPrL6QB4xoBI0DRWaERmnoQ9cDC8NLe/uDnlA9YS5V5QSjeOv?= =?us-ascii?Q?sqF4aFpKjc3yIKjMokd7o4EzcOaV4UpuVdRE8t0lM0FC1Y7FhziXTG+lzsn4?= =?us-ascii?Q?EmMQIm+FRpm/SEVN+IXr0v37i7CqvtTumgdV/z3ToDy6I0BfwN83cglSOPeQ?= =?us-ascii?Q?tEyQRH2uRrO/Wi7dw3zu7QwGacdHEQAZJp6jYPuXNzMByeEF2Z0yYS72mba5?= =?us-ascii?Q?sYMkXwzcpTbceut6ptH9I5Rmn/NBcyNvM3LvzjS4xQwL738Y5cyDjHhhHcw?= =?us-ascii?Q?=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 400220a9-bea1-4dad-c389-08db86dbc872 X-MS-Exchange-CrossTenant-AuthSource: DM5PR03MB3163.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 15:37:52.7488 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR03MB6417 Received-SPF: pass client-ip=2a01:111:f400:7e88::827; envelope-from=Morgan.J.Smith@outlook.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx2.migadu.com X-Migadu-Spam-Score: -9.98 X-Spam-Score: -9.98 X-Migadu-Queue-Id: 880E73DCDA X-TUID: Ni/PjwkfiimV * testing/lisp/test-org-agenda.el (test-org-agenda/check-for-timestamp-as-reason-to-ignore-todo-item): New test. --- testing/lisp/test-org-agenda.el | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/testing/lisp/test-org-agenda.el b/testing/lisp/test-org-agenda.el index c4bd4f0a7..66f2f5bce 100644 --- a/testing/lisp/test-org-agenda.el +++ b/testing/lisp/test-org-agenda.el @@ -329,6 +329,62 @@ DEADLINE: <2023-07-15 Sat>" "* TODO write better tests" (org-agenda-skip-if nil options)))))) +(ert-deftest test-org-agenda/check-for-timestamp-as-reason-to-ignore-todo-item () + "Test `org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item'." + (let ((org-deadline-warning-days 1) + (expected-return + (lambda (timestamp value) + (cl-case timestamp + (past (not (not (memq value '(past all -1 -2 near))))) + (yesteryesterday (not (not (memq value '(past all -1 -2 near))))) + (yesterday (not (not (memq value '(past all -1 near))))) + (today (not (not (memq value '(all past 0 near))))) + (tomorrow (not (not (memq value '(future all 1 0 near))))) + (tomorroworrow (not (not (memq value '(future all 2 1 0 far))))) + (future (not (not (memq value '(future all 2 1 0 far)))))))) + ;; Lexically bind the variables we're changing + org-agenda-todo-ignore-deadlines + org-agenda-todo-ignore-scheduled + org-agenda-todo-ignore-timestamp) + (org-test-at-time "2023-01-15" + (dolist (variable '(org-agenda-todo-ignore-deadlines + org-agenda-todo-ignore-scheduled + org-agenda-todo-ignore-timestamp)) + (dolist (type '(timestamp scheduled deadline)) + ;; nil is last so it resets the variable for the next one + (dolist (value `(past future all 2 1 0 -1 -2 + ,@(when (eq type 'deadline) '(near far nil)))) + (dolist (timestamp '((past . "<2022-01-15>") + (yesteryesterday . "<2023-01-13>") + (yesterday . "<2023-01-14>") + (today . "<2023-01-15>") + (tomorrow . "<2023-01-16>") + (tomorroworrow . "<2023-01-17>") + (future . "<2024-01-15>"))) + ;; Uncomment to debug failure + ;; (message "Type: %S, Variable: %S, Value: %S, Time: %S" type variable value (car timestamp)) + (set variable value) + (should + (equal + (cl-case variable + (org-agenda-todo-ignore-deadlines + (when (eq type 'deadline) + (funcall expected-return (car timestamp) value))) + (org-agenda-todo-ignore-scheduled + (when (eq type 'scheduled) + (funcall expected-return (car timestamp) value))) + (org-agenda-todo-ignore-timestamp + (when (eq type 'timestamp) + (funcall expected-return (car timestamp) value)))) + (org-test-with-temp-text + (cl-case type + (timestamp (concat "* hello " (cdr timestamp))) + (scheduled (concat "* hello +SCHEDULED: " (cdr timestamp))) + (deadline (concat "* hello +DEADLINE: " (cdr timestamp)))) + (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item))))))))))) + (ert-deftest test-org-agenda/goto-date () "Test `org-agenda-goto-date'." (unwind-protect -- 2.41.0