summaryrefslogtreecommitdiff
path: root/tests/testutil-org.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-02-15 21:14:18 -0600
committerCraig Jennings <c@cjennings.net>2026-02-15 21:14:18 -0600
commitedfb11b1a161d39a3f88279bc7b395aa8e6f68b7 (patch)
tree10805d200687e3477b2c250871050ccc0b144a5d /tests/testutil-org.el
parent61bfb79f2c55983697f87b9ba3961a9fb46de2fe (diff)
test: add 38 tests for org-agenda-config and org-refile-config
- testutil-org.el: shared dynamic timestamp helpers (days-ago, days-ahead, today) - org-agenda-config: 31 tests across 2 files (skip functions + add-files) - org-refile-config: 7 tests for ensure-org-mode validation - Remove prog-shell from checklist (fully covered by existing 9 tests)
Diffstat (limited to 'tests/testutil-org.el')
-rw-r--r--tests/testutil-org.el32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/testutil-org.el b/tests/testutil-org.el
new file mode 100644
index 00000000..c1949981
--- /dev/null
+++ b/tests/testutil-org.el
@@ -0,0 +1,32 @@
+;;; testutil-org.el --- Test utilities for org-mode tests -*- lexical-binding: t; -*-
+;;
+;; Author: Craig Jennings <c@cjennings.net>
+;;
+;;; Commentary:
+;; Utilities for testing org-mode related modules.
+;; Provides dynamic timestamp generation for deterministic date-sensitive tests.
+;; No hardcoded dates — all timestamps generated relative to current time.
+;;
+;; See also: testutil-calendar-sync.el for iCal-specific timestamp utilities.
+
+;;; Code:
+
+(defun test-org-timestamp-days-ago (days)
+ "Generate org timestamp string for DAYS ago.
+Returns string like \"<2026-02-10 Tue>\"."
+ (format-time-string "<%Y-%m-%d %a>"
+ (time-subtract (current-time) (* days 86400))))
+
+(defun test-org-timestamp-days-ahead (days)
+ "Generate org timestamp string for DAYS from now.
+Returns string like \"<2026-02-20 Fri>\"."
+ (format-time-string "<%Y-%m-%d %a>"
+ (time-add (current-time) (* days 86400))))
+
+(defun test-org-timestamp-today ()
+ "Generate org timestamp string for today.
+Returns string like \"<2026-02-15 Sun>\"."
+ (format-time-string "<%Y-%m-%d %a>"))
+
+(provide 'testutil-org)
+;;; testutil-org.el ends here