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 wOEMJAbcQ2Rj9gAASxT56A (envelope-from ) for ; Sat, 22 Apr 2023 15:07:18 +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 IL3RIwbcQ2SFVAEAauVa8A (envelope-from ) for ; Sat, 22 Apr 2023 15:07:18 +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 34A17759D for ; Sat, 22 Apr 2023 15:07:18 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqCur-0007yD-NA; Sat, 22 Apr 2023 09:04:37 -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 1pqCuo-0007qx-Dm for emacs-orgmode@gnu.org; Sat, 22 Apr 2023 09:04:35 -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 1pqCum-0004X8-Ic for emacs-orgmode@gnu.org; Sat, 22 Apr 2023 09:04:34 -0400 Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id e5ee3c81 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 22 Apr 2023 13:04:30 +0000 (UTC) References: User-agent: mu4e 1.9.22; emacs 30.0.50 To: Ruijie Yu Cc: Axel Kielhorn , emacs-orgmode@gnu.org Subject: [DRAFT PATCH v2] Decouple LANG= and testing (was: Test failure due to LANG) Date: Sat, 22 Apr 2023 21:01:39 +0800 In-reply-to: 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-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682168838; a=rsa-sha256; cv=none; b=O2aeFoWxzFB3yowAECH2A7aKMwoj3pk6zlMf6UK9kJXG4ahj9TRKM/wQNFxWQXXnU1v+Vp 8qj1YhCTk7Qa7acBCj8zt6LshPtoPnThkgFpMaLmzTZUfQZJWjhqtJdOgxijA4mbyVGir0 wTS72Jr9QwAwaoQX9pBm7AO43/pHgJ3xkoGPPvxJbdnKROESiN1Vsh35bAmfwsFWTpkzaS 8EBu5lSM8HmCaD8kCaDnTIkrUVMMrsz1DmpjsVXP1MnQZ0+JAq6N8a3DOyLBE+u6Zr1WiY F27TlHyPSumj0eUzGjhEnIBjdSzFPOw8ndzeZaYeNfjlKUwkVtPKlg1vOIDDpA== 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=1682168838; 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=alc2EpLYfbQv7gtnOXDPAlPMIa//Jrh3c3QsCWs3PYs=; b=Rzb8D21ZMZSBR1QpP+cb0UHtd6bWrvqRhBaiU40t47eynGCkSx5UicewuqVoFynx/JqwZf yIWZXoWh9Cosl3TvV0Cm349djMEhA/8IbWFzGhpWIbSAqeV6AQP++yDAhmXBOBLk+BC7xj kZnDEZ7QMVulrEv0UvcihC0rG8RTBYLqfHg5gvid4ql0DHosW9nT9bOiZ9Rr2TIYIRHWXx q2Z0Wv5QluqG+YhnDXgMH2TveLyWH91JepORRnWynI+4a9sdK052q9t6UWHxS/lmB3PRmk jQ+CyrBU9uVB0J5rqZExhk+1CxhI6qP0u1SyLkV+zkt4BQZWugQ/F/XnLqhQYw== X-Migadu-Scanner: scn1.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-Migadu-Spam-Score: -2.51 X-Spam-Score: -2.51 X-Migadu-Queue-Id: 34A17759D X-TUID: r4ZHL4oq7p5N --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ruijie Yu via "General discussions about Org-mode." = writes: > Ruijie Yu via "General discussions about Org-mode." writes: > >> Ruijie Yu via "General discussions about Org-mode." writes: >> >>> Axel Kielhorn writes: >>> >>>> Hello! >>>> >>>> I=E2=80=99m building org with LANG=3Dde. >>>> As a result I get two failed tests: >>> >>> Reproducible using "LANG=3Dzh_CN.UTF-8". In fact, I got more failed te= sts >>> in my testing. I think the OP's two test failures are due to hardcoded >>> English expected result, whereas the additional test failures on my >>> testing are probably due to the fact that each Chinese character is as >>> wide as two latin letters, which catches some testing code offguard. >>> >>> Here are the test names that failed unexpectedly for me. All the >>> "should"'s and "should-not"'s are in the attachment below. >>> >>> --8<---------------cut here---------------start------------->8--- >>> 8 unexpected results: >>> FAILED test-org-clock/clock-drawer-dwim >>> FAILED test-org-clock/clocktable/lang >>> FAILED test-org-clok/org-clock-timestamps-change >>> FAILED test-org-colview/columns-width >>> FAILED test-org/add-planning-info >>> FAILED test-org/clone-with-time-shift >>> FAILED test-org/deadline >>> FAILED test-org/schedule >>> --8<---------------cut here---------------end--------------->8--- >>> >>> [3. text/plain; lang.txt]... >> >> Update: interestingly, there is one test error when setting >> "LANG=3Den_US.UTF-8" or "LANG=3DC". >> >> [2. text/plain; lang-en-us-utf8.txt]... >> >> >> And, two somewhat different test errors when setting "LANG=3Dfr_FR.UTF-8= ". >> >> [4. text/plain; lang-fr-fr-utf8.txt]... > > Axel, does this patch fix test-org-clock/clock-drawer-dwim on your > system? > > [2. text/x-patch; 0001-testing-lisp-test-org-clock.el.patch]... Here is an updated patch (replacing the first iteration). This should hopefully fix both test failures that Axel found. Once this is confirmed good, I will look at the test failures of the other languages to see what I can do. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-DRAFT-Fix-dependence-on-locale-in-org-testing-facili.patch >From aed711f260b7214e7264df63e3154f4a75e5c5e5 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 | 23 +++++++++++++ 2 files changed, 57 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..a303bec90 100644 --- a/testing/org-test.el +++ b/testing/org-test.el @@ -547,6 +547,29 @@ 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 + (seq-map (apply-partially #'format-time-string "%a") + org-test-day-of-weeks-seconds) + "Abbreviated names of days of week.") + +(defconst org-test-day-of-weeks-full + (seq-map (apply-partially #'format-time-string "%A") + org-test-day-of-weeks-seconds) + "Full names for days of week.") + + + (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.] --=-=-=--