summaryrefslogtreecommitdiff
path: root/tests/testutil-org.el
blob: c1949981d69ab42809fb2426b22f0c9572b3efda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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