Ruijie Yu via "General discussions about Org-mode." <emacs-orgmode@gnu.org> writes:
> Ruijie Yu via "General discussions about Org-mode." <emacs-orgmode@gnu.org> > writes: > >> Ruijie Yu via "General discussions about Org-mode." <emacs-orgmode@gnu.org> >> writes: >> >>> Axel Kielhorn <org-m...@axelkielhorn.de> writes: >>> >>>> Hello! >>>> >>>> I’m building org with LANG=de. >>>> As a result I get two failed tests: >>> >>> Reproducible using "LANG=zh_CN.UTF-8". In fact, I got more failed tests >>> 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=en_US.UTF-8" or "LANG=C". >> >> [2. text/plain; lang-en-us-utf8.txt]... >> >> >> And, two somewhat different test errors when setting "LANG=fr_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.
>From aed711f260b7214e7264df63e3154f4a75e5c5e5 Mon Sep 17 00:00:00 2001 From: Ruijie Yu <rui...@netyu.xyz> 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 2<point>2: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:<point>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 2<point>3: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 2<point>2: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:<point>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 2<point>3: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: <point>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
-- Best, RY [Please note that this mail might go to spam due to some misconfiguration in my mail server -- still investigating.]