[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 9730f408c2 3/7: testing/org-test.el: New helper fun
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 9730f408c2 3/7: testing/org-test.el: New helper function `org-test-get-day-name' |
Date: |
Mon, 17 Jul 2023 06:59:27 -0400 (EDT) |
branch: externals/org
commit 9730f408c20d2cccdcd72ee1c508859d2b64a3ec
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
testing/org-test.el: New helper function `org-test-get-day-name'
* testing/org-test.el (org-test-get-day-name): New function to convert
English day name to current locale.
* testing/lisp/test-org-clock.el
(test-org-clock/org-clock-timestamps-change):
(test-org-clock/clock-drawer-dwim): Use the new function instead of
direct `aref'.
---
testing/lisp/test-org-clock.el | 6 +++---
testing/org-test.el | 17 +++++++++++++++++
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index 19d0c68ecf..fe51b12b6b 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -91,8 +91,8 @@ the buffer."
(ert-deftest test-org-clock/org-clock-timestamps-change ()
"Test `org-clock-timestamps-change' specifications."
- (let ((sun (aref org-test-day-of-weeks-abbrev 0))
- (mon (aref org-test-day-of-weeks-abbrev 1)))
+ (let ((sun (org-test-get-day-name "Sun"))
+ (mon (org-test-get-day-name "Mon")))
(should
(equal
(format "CLOCK: [2023-02-19 %s 21:30]--[2023-02-19 %s 23:35] => 2:05"
@@ -318,7 +318,7 @@ the buffer."
(ert-deftest test-org-clock/clock-drawer-dwim ()
"Test DWIM update of days for clocks in logbook drawers."
- (let ((thu (aref org-test-day-of-weeks-abbrev 4)))
+ (let ((thu (org-test-get-day-name "Thu")))
(should (equal (format "* Foo
:LOGBOOK:
CLOCK: [2022-11-03 %s 06:00]--[2022-11-03 %s 06:01] => 0:01
diff --git a/testing/org-test.el b/testing/org-test.el
index ced281e235..47687b9f7a 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -572,6 +572,23 @@ See `org-test-day-of-weeks-seconds'.")
"Vector of full names for days of week.
See `org-test-day-of-weeks-seconds'.")
+(defun org-test-get-day-name (day &optional full)
+ "Return string containing locale-specific DAY abbrev.
+DAY Should be Mon, Tue, ...
+When FULL is non-nil, return the full name like Monday, Tuesday, ..."
+ (aref
+ (if full org-test-day-of-weeks-full
+ org-test-day-of-weeks-abbrev)
+ (pcase day
+ ((or "Sun" "Sunday") 0)
+ ((or "Mon" "Monday") 1)
+ ((or "Tue" "Tuesday") 2)
+ ((or "Wed" "Wednesday") 3)
+ ((or "Thu" "Thursday") 4)
+ ((or "Fri" "Friday") 5)
+ ((or "Sat" "Saturday") 6)
+ (_ (error "Unknown day of week: %s" day)))))
+
(provide 'org-test)
;;; org-test.el ends here
- [elpa] externals/org updated (a1ef64f3d1 -> 5b6268c29e), ELPA Syncer, 2023/07/17
- [elpa] externals/org ab9c9732ea 1/7: Fix dependence on locale in org testing facilities, ELPA Syncer, 2023/07/17
- [elpa] externals/org 8739a95782 2/7: Let org-columns correctly detect string-widths in code, ELPA Syncer, 2023/07/17
- [elpa] externals/org 26440689aa 4/7: org-test-without-dow: Make name consistent with what the macro does, ELPA Syncer, 2023/07/17
- [elpa] externals/org c730caf512 5/7: org-babel-result-to-file: Fix when in indirect buffer, ELPA Syncer, 2023/07/17
- [elpa] externals/org 9730f408c2 3/7: testing/org-test.el: New helper function `org-test-get-day-name',
ELPA Syncer <=
- [elpa] externals/org 3007511f3f 6/7: org-string-width: Reuse buffer when calculating string width, ELPA Syncer, 2023/07/17
- [elpa] externals/org 5b6268c29e 7/7: org-columns--truncate-below-width: Fix Emacs 27 compatibility, ELPA Syncer, 2023/07/17