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 ms9.migadu.com with LMTPS id oKitE3CPRGS0/QAASxT56A (envelope-from ) for ; Sun, 23 Apr 2023 03:52:48 +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 qBipE3CPRGRXhAEAauVa8A (envelope-from ) for ; Sun, 23 Apr 2023 03:52:48 +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 01E491456D for ; Sun, 23 Apr 2023 03:52:47 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqOtC-0007oZ-1d; Sat, 22 Apr 2023 21:51:42 -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 1pqOtA-0007oB-Cx for emacs-orgmode@gnu.org; Sat, 22 Apr 2023 21:51:40 -0400 Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqOt6-0003ML-Iw for emacs-orgmode@gnu.org; Sat, 22 Apr 2023 21:51:39 -0400 Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id 3bec625a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 23 Apr 2023 01:51:33 +0000 (UTC) References: <32E3D56A-9DDF-4D70-BBA6-2DB71919EC98@axelkielhorn.de> User-agent: mu4e 1.9.22; emacs 30.0.50 To: Axel Kielhorn Cc: emacs-orgmode@gnu.org Subject: Re: [DRAFT PATCH v3] Decouple LANG= and testing (was: Test failure due to LANG) In-reply-to: Date: Sun, 23 Apr 2023 09:47:35 +0800 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=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: , Reply-to: Ruijie Yu From: Ruijie Yu via "General discussions about Org-mode." Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682214767; a=rsa-sha256; cv=none; b=BtFvy4S7gVHpG+3fDKhmZp4DjFbwY+7yVyd7vZn5htBFuq7xqlXA/e6AZ9ryM8L6yTA4HB +8XYZkNXee9OCioFA5+5EhvpWiez7sZNTyeWMBBGAfTbofrOv0hbJ2hng0LYqo5wxh0Wst Q/Hkg/xTvSQskoplOoMkQiPtJfspiKq1WUzMfNBsBex48xgviMWP0a89Cwu50JP3Z59iYW 3yZ8/eShPr7zxLSlm1JTU12fzYLjW3tLWnkGa7qK3hZhHYnYHj4vQ6kd+8e5LYi/BJIo8x A38xSEBmFzGyYFMkof3965FBaYatT+hfw49hJ1uuxq+4SwK658x1ItIIgx7q/A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1682214767; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=Z+RnPMNvWwKahZEzhf49gUmfRYjIJ+06Q5NY40JjaPQ=; b=jki/d1pSMJ5xjAp6IdBEIsur5T8+PZIG0vJ2blxUfg41Hh442iOiiiYtbcfLRodbMfo5jS 80/8tjrn5cbtpgs0zS7zE6SIkPLI9hWqC4lnciC59yKBwpEq9MiRtIzJyh3YwTSiB2lmJI NTMD95ks/RiiX8wamAp5GjTE+15PyzfPplsEXowmbMZuK2krVxUOzpceqDnTibX3Y7P7mj HPdTyKkaxxNgIRvJ6MIGk6ia3V/goyDL8oTGbKyiT9UA4BEPcwNvSjfH8qKQ7tmDAgQOK2 ivKpTKLryteGaNcjag3IWXzqya1gfgfnFj/Yf8uhU6cyc6gPKpRTTnXoIsRamQ== X-Migadu-Spam-Score: -1.51 X-Spam-Score: -1.51 X-Migadu-Queue-Id: 01E491456D X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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" X-TUID: k3p5ThpHdM9Q --=-=-= Content-Type: text/plain Ruijie Yu via "General discussions about Org-mode." writes: > Axel Kielhorn writes: > >> With this patch I get: >> FAILED test-org-clock/clock-drawer-dwim arrayp >> FAILED test-org-clok/org-clock-timestamps-change arrayp >> >> Axel > > Thanks for testing. Will take a look tomorrow. Apparently `seq-map' does not preserve the type of its input. This patch be good then? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-DRAFT-Fix-dependence-on-locale-in-org-testing-facili.patch >From 7621108e377c71cf083389e7bdb6f9d76cd07461 Mon Sep 17 00:00:00 2001 From: Ruijie Yu Date: Sat, 22 Apr 2023 20:36:18 +0800 Subject: [PATCH] [DRAFT] Fix dependence on locale in org testing facilities * testing/org-test.el org-test-day-of-weeks-seconds: add values of seconds that yield different days of week (by trial-and-error). org-test-day-of-weeks-abbrev: add a vector of abbreviated DoW names for testing. org-test-day-of-weeks-full: add a vector of full DoW names for testing. * testing/lisp/test-org-clock.el (test-org-clok/org-clock-timestamps-change): (test-org-clock/clock-drawer-dwim): make use of the pre-generated DoW names in the testing to remove assumptions on LANG=C. --- testing/lisp/test-org-clock.el | 62 +++++++++++++++++++--------------- testing/org-test.el | 25 ++++++++++++++ 2 files changed, 59 insertions(+), 28 deletions(-) diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el index 7d8123e1f..4d9306619 100644 --- a/testing/lisp/test-org-clock.el +++ b/testing/lisp/test-org-clock.el @@ -91,27 +91,32 @@ the buffer." (ert-deftest test-org-clok/org-clock-timestamps-change () "Test `org-clock-timestamps-change' specifications." - (should - (equal - "CLOCK: [2023-02-19 Sun 21:30]--[2023-02-19 Sun 23:35] => 2:05" - (org-test-with-temp-text - "CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20 Mon 00:35] => 2:05" - (org-clock-timestamps-change 'down 1) - (buffer-string)))) - (should - (equal - "CLOCK: [2023-02-20 Mon 00:00]--[2023-02-20 Mon 00:40] => 0:40" - (org-test-with-temp-text - "CLOCK: [2023-02-19 Sun 23:55]--[2023-02-20 Mon 00:35] => 0:40" - (org-clock-timestamps-change 'up 1) - (buffer-string)))) - (should - (equal - "CLOCK: [2023-02-20 Mon 00:30]--[2023-02-20 Mon 01:35] => 1:05" - (org-test-with-temp-text - "CLOCK: [2023-02-19 Sun 23:30]--[2023-02-20 Mon 00:35] => 1:05" - (org-clock-timestamps-change 'up 1) - (buffer-string))))) + (let ((sun (aref org-test-day-of-weeks-abbrev 0)) + (mon (aref org-test-day-of-weeks-abbrev 1))) + (should + (equal + (format "CLOCK: [2023-02-19 %s 21:30]--[2023-02-19 %s 23:35] => 2:05" + sun sun) + (org-test-with-temp-text + "CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20 Mon 00:35] => 2:05" + (org-clock-timestamps-change 'down 1) + (buffer-string)))) + (should + (equal + (format "CLOCK: [2023-02-20 %s 00:00]--[2023-02-20 %s 00:40] => 0:40" + mon mon) + (org-test-with-temp-text + "CLOCK: [2023-02-19 Sun 23:55]--[2023-02-20 Mon 00:35] => 0:40" + (org-clock-timestamps-change 'up 1) + (buffer-string)))) + (should + (equal + (format "CLOCK: [2023-02-20 %s 00:30]--[2023-02-20 %s 01:35] => 1:05" + mon mon) + (org-test-with-temp-text + "CLOCK: [2023-02-19 Sun 23:30]--[2023-02-20 Mon 00:35] => 1:05" + (org-clock-timestamps-change 'up 1) + (buffer-string)))))) ;;; Clock drawer @@ -299,19 +304,20 @@ the buffer." (ert-deftest test-org-clock/clock-drawer-dwim () "Test DWIM update of days for clocks in logbook drawers." - (should (equal "* Foo + (let ((thu (aref org-test-day-of-weeks-abbrev 4))) + (should (equal (format "* Foo :LOGBOOK: -CLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] => 0:01 +CLOCK: [2022-11-03 %s 06:00]--[2022-11-03 %s 06:01] => 0:01 :END: -" - (org-test-with-temp-text - "* Foo +" thu thu) + (org-test-with-temp-text + "* Foo :LOGBOOK: CLOCK: [2022-11-03 ??? 06:00]--[2022-11-03 ??? 06:01] => 0:01 :END: " - (org-ctrl-c-ctrl-c) - (buffer-string))))) + (org-ctrl-c-ctrl-c) + (buffer-string)))))) ;;; Clocktable diff --git a/testing/org-test.el b/testing/org-test.el index 22ac60670..ced281e23 100644 --- a/testing/org-test.el +++ b/testing/org-test.el @@ -547,6 +547,31 @@ TIME can be a non-nil Lisp time value, or a string specifying a date and time." ,@body) (nreverse messages))) +(defconst org-test-day-of-weeks-seconds + [121223891 ; Sun + 30000000 ; Mon + 2222222 ; Tue + 500000 ; Wed + 1000 ; Thu + 89173 ; Fri + 666666666] ; Sat + "Epoch seconds for generating days of week strings. +Starts at Sunday, ends at Saturday.") + +(defconst org-test-day-of-weeks-abbrev + (apply #'vector + (seq-map (apply-partially #'format-time-string "%a") + org-test-day-of-weeks-seconds)) + "Vector of abbreviated names of days of week. +See `org-test-day-of-weeks-seconds'.") + +(defconst org-test-day-of-weeks-full + (apply #'vector + (seq-map (apply-partially #'format-time-string "%A") + org-test-day-of-weeks-seconds)) + "Vector of full names for days of week. +See `org-test-day-of-weeks-seconds'.") + (provide 'org-test) ;;; org-test.el ends here -- 2.40.0 --=-=-= Content-Type: text/plain -- Best, RY [Please note that this mail might go to spam due to some misconfiguration in my mail server -- still investigating.] --=-=-=--