diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-24 16:18:27 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-24 16:18:27 -0400 |
| commit | d47f4f90bb1c69697a855a662bb07be1e0ccdc33 (patch) | |
| tree | 777d0b786a530cb4190f8e062e0afda2506308d4 /tests/test-chime-timestamp-parse.el | |
| parent | ab8cc4da57fce5d0a59f4db34fb550919a06ea79 (diff) | |
| download | chime-d47f4f90bb1c69697a855a662bb07be1e0ccdc33.tar.gz chime-d47f4f90bb1c69697a855a662bb07be1e0ccdc33.zip | |
Every test hand-wrote the same scaffolding: call a per-file setup, wrap the body in unwind-protect, call a per-file teardown. That's 419 unwind-protect blocks and 68 near-identical setup/teardown defuns, with no shared fixture because ERT has no native per-test setup.
I added a chime-deftest macro in test-bootstrap that creates the test base directory before the body and deletes it afterward, even on failure. I converted the 10 files whose fixture was exactly that base-dir create/delete and whose every test followed the standard shape, dropping their setup/teardown defuns. Files with custom fixtures (modeline state restore, validation reset) keep explicit setup/teardown, since the macro would silently drop their extra logic. I left the 4 tag-bearing integration files alone.
I also moved the near-universal testutil-general and testutil-time requires into test-bootstrap, so individual files no longer repeat them.
Behavior is unchanged: still 800 tests, full suite green. Converted bodies are copied verbatim, so the change only removes scaffolding, never an assertion.
Diffstat (limited to 'tests/test-chime-timestamp-parse.el')
| -rw-r--r-- | tests/test-chime-timestamp-parse.el | 508 |
1 files changed, 208 insertions, 300 deletions
diff --git a/tests/test-chime-timestamp-parse.el b/tests/test-chime-timestamp-parse.el index 5dc30bf..e06b832 100644 --- a/tests/test-chime-timestamp-parse.el +++ b/tests/test-chime-timestamp-parse.el @@ -26,375 +26,283 @@ (require 'test-bootstrap (expand-file-name "test-bootstrap.el")) -;; Load test utilities -(require 'testutil-general (expand-file-name "testutil-general.el")) -(require 'testutil-time (expand-file-name "testutil-time.el")) - -;;; Setup and Teardown - -(defun test-chime-timestamp-parse-setup () - "Setup function run before each test." - (chime-create-test-base-dir)) - -(defun test-chime-timestamp-parse-teardown () - "Teardown function run after each test." - (chime-delete-test-base-dir)) - ;;; Normal Cases -(ert-deftest test-chime-timestamp-parse-standard-timestamp-returns-time-list () +(chime-deftest test-chime-timestamp-parse-standard-timestamp-returns-time-list () "Test that a standard timestamp with time component returns a time list. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((time (test-time-tomorrow-at 14 30)) - (timestamp (test-timestamp-string time)) - (result (chime--timestamp-parse timestamp))) - ;; Should return a time list (list of integers) - (should (listp result)) - (should (= (length result) 2)) - (should (integerp (car result))) - (should (integerp (cadr result))) - ;; Result should not be nil - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-scheduled-timestamp-returns-time-list () + (let* ((time (test-time-tomorrow-at 14 30)) + (timestamp (test-timestamp-string time)) + (result (chime--timestamp-parse timestamp))) + ;; Should return a time list (list of integers) + (should (listp result)) + (should (= (length result) 2)) + (should (integerp (car result))) + (should (integerp (cadr result))) + ;; Result should not be nil + (should result))) + +(chime-deftest test-chime-timestamp-parse-scheduled-timestamp-returns-time-list () "Test that a SCHEDULED timestamp parses correctly. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((time (test-time-tomorrow-at 9 0)) - (timestamp (test-timestamp-string time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-deadline-timestamp-returns-time-list () + (let* ((time (test-time-tomorrow-at 9 0)) + (timestamp (test-timestamp-string time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-deadline-timestamp-returns-time-list () "Test that a DEADLINE timestamp parses correctly. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((time (test-time-tomorrow-at 17 0)) - (timestamp (test-timestamp-string time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-timestamp-with-weekly-repeater-returns-time-list () + (let* ((time (test-time-tomorrow-at 17 0)) + (timestamp (test-timestamp-string time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-timestamp-with-weekly-repeater-returns-time-list () "Test that a timestamp with +1w repeater parses correctly. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((time (test-time-tomorrow-at 14 0)) - (timestamp (format-time-string "<%Y-%m-%d %a %H:%M +1w>" time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-timestamp-with-completion-repeater-returns-time-list () + (let* ((time (test-time-tomorrow-at 14 0)) + (timestamp (format-time-string "<%Y-%m-%d %a %H:%M +1w>" time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-timestamp-with-completion-repeater-returns-time-list () "Test that a timestamp with .+1d repeater parses correctly. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((time (test-time-tomorrow-at 8 0)) - (timestamp (format-time-string "<%Y-%m-%d %a %H:%M .+1d>" time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-timestamp-with-catchup-repeater-returns-time-list () + (let* ((time (test-time-tomorrow-at 8 0)) + (timestamp (format-time-string "<%Y-%m-%d %a %H:%M .+1d>" time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-timestamp-with-catchup-repeater-returns-time-list () "Test that a timestamp with ++1w repeater parses correctly. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((time (test-time-tomorrow-at 10 30)) - (timestamp (format-time-string "<%Y-%m-%d %a %H:%M ++1w>" time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-timestamp-with-time-range-returns-start-time () + (let* ((time (test-time-tomorrow-at 10 30)) + (timestamp (format-time-string "<%Y-%m-%d %a %H:%M ++1w>" time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-timestamp-with-time-range-returns-start-time () "Test that a timestamp with time range returns the start time. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((time (test-time-tomorrow-at 14 0)) - (timestamp (format-time-string "<%Y-%m-%d %a %H:%M-15:30>" time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-timestamp-with-date-range-returns-start-date () + (let* ((time (test-time-tomorrow-at 14 0)) + (timestamp (format-time-string "<%Y-%m-%d %a %H:%M-15:30>" time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-timestamp-with-date-range-returns-start-date () "Test that a timestamp with date range returns start date time. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((time1 (test-time-tomorrow-at 10 0)) - (time2 (test-time-days-from-now 2)) - (timestamp (concat (test-timestamp-string time1) "--" - (format-time-string "<%Y-%m-%d %a %H:%M>" time2))) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) + (let* ((time1 (test-time-tomorrow-at 10 0)) + (time2 (test-time-days-from-now 2)) + (timestamp (concat (test-timestamp-string time1) "--" + (format-time-string "<%Y-%m-%d %a %H:%M>" time2))) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) ;;; Boundary Cases -(ert-deftest test-chime-timestamp-parse-midnight-timestamp-returns-time-list () +(chime-deftest test-chime-timestamp-parse-midnight-timestamp-returns-time-list () "Test that midnight (00:00) timestamp parses correctly. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((time (test-time-tomorrow-at 0 0)) - (timestamp (test-timestamp-string time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-last-minute-of-day-returns-time-list () + (let* ((time (test-time-tomorrow-at 0 0)) + (timestamp (test-timestamp-string time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-last-minute-of-day-returns-time-list () "Test that last minute of day (23:59) timestamp parses correctly. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((time (test-time-tomorrow-at 23 59)) - (timestamp (test-timestamp-string time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-year-boundary-new-years-eve-returns-time-list () + (let* ((time (test-time-tomorrow-at 23 59)) + (timestamp (test-timestamp-string time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-year-boundary-new-years-eve-returns-time-list () "Test that New Year's Eve timestamp parses correctly. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((now (test-time-now)) - (decoded (decode-time now)) - (year (nth 5 decoded)) - ;; Create Dec 31 at 23:30 for current test year - (time (encode-time 0 30 23 31 12 year)) - (timestamp (test-timestamp-string time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-year-boundary-new-years-day-returns-time-list () + (let* ((now (test-time-now)) + (decoded (decode-time now)) + (year (nth 5 decoded)) + ;; Create Dec 31 at 23:30 for current test year + (time (encode-time 0 30 23 31 12 year)) + (timestamp (test-timestamp-string time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-year-boundary-new-years-day-returns-time-list () "Test that New Year's Day timestamp parses correctly. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((now (test-time-now)) - (decoded (decode-time now)) - (year (1+ (nth 5 decoded))) ; Next year - ;; Create Jan 1 at 00:30 for next test year - (time (encode-time 0 30 0 1 1 year)) - (timestamp (test-timestamp-string time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-single-digit-time-returns-time-list () + (let* ((now (test-time-now)) + (decoded (decode-time now)) + (year (1+ (nth 5 decoded))) ; Next year + ;; Create Jan 1 at 00:30 for next test year + (time (encode-time 0 30 0 1 1 year)) + (timestamp (test-timestamp-string time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-single-digit-time-returns-time-list () "Test that single-digit hours and minutes parse correctly. REFACTORED: Uses dynamic timestamps" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((time (test-time-tomorrow-at 1 5)) - (timestamp (test-timestamp-string time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-leap-year-feb-29-returns-time-list () + (let* ((time (test-time-tomorrow-at 1 5)) + (timestamp (test-timestamp-string time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-leap-year-feb-29-returns-time-list () "Test that Feb 29 in leap year parses correctly. REFACTORED: Uses dynamic timestamps (2024 leap year)" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* (;; Use 2024 as a known leap year - (time (encode-time 0 0 14 29 2 2024)) - (timestamp (test-timestamp-string time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-month-boundary-end-of-month-returns-time-list () + (let* (;; Use 2024 as a known leap year + (time (encode-time 0 0 14 29 2 2024)) + (timestamp (test-timestamp-string time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) + +(chime-deftest test-chime-timestamp-parse-month-boundary-end-of-month-returns-time-list () "Test that end of month timestamp parses correctly. REFACTORED: Uses dynamic timestamps (Oct 31)" - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((now (test-time-now)) - (decoded (decode-time now)) - (year (nth 5 decoded)) - ;; Create Oct 31 at 14:00 for current test year - (time (encode-time 0 0 14 31 10 year)) - (timestamp (test-timestamp-string time)) - (result (chime--timestamp-parse timestamp))) - (should (listp result)) - (should (= (length result) 2)) - (should result)) - (test-chime-timestamp-parse-teardown))) + (let* ((now (test-time-now)) + (decoded (decode-time now)) + (year (nth 5 decoded)) + ;; Create Oct 31 at 14:00 for current test year + (time (encode-time 0 0 14 31 10 year)) + (timestamp (test-timestamp-string time)) + (result (chime--timestamp-parse timestamp))) + (should (listp result)) + (should (= (length result) 2)) + (should result))) ;;; Bug Reproduction Tests -(ert-deftest test-chime-timestamp-parse-tomorrow-timestamp-returns-correct-date () +(chime-deftest test-chime-timestamp-parse-tomorrow-timestamp-returns-correct-date () "Test that a tomorrow timestamp is parsed as tomorrow, not today. This reproduces the bug where timestamps like <2025-11-03 Mon 10:00-10:30> on Nov 02 are incorrectly grouped as 'Today' instead of 'Tomorrow'." - (test-chime-timestamp-parse-setup) - (unwind-protect - (with-test-time (encode-time 0 23 11 2 11 2025) ; Nov 02, 2025 11:23:00 AM - (let* ((tomorrow-timestamp "<2025-11-03 Mon 10:00-10:30>") - (parsed (chime--timestamp-parse tomorrow-timestamp)) - (now (current-time))) - ;; Should parse successfully - (should parsed) - ;; Convert parsed time (HIGH LOW) to full time by appending (0 0) - (let* ((parsed-time (append parsed '(0 0))) - (parsed-decoded (decode-time parsed-time)) - (time-diff-seconds (- (time-to-seconds parsed-time) - (time-to-seconds now)))) - ;; Verify the parsed date is Nov 03, 2025 (not Nov 02!) - (should (= 3 (decoded-time-day parsed-decoded))) - (should (= 11 (decoded-time-month parsed-decoded))) - (should (= 2025 (decoded-time-year parsed-decoded))) - ;; Verify the parsed time is 10:00 - (should (= 10 (decoded-time-hour parsed-decoded))) - (should (= 0 (decoded-time-minute parsed-decoded))) - ;; Time difference should be ~22h 37m (81420 seconds) - (should (> time-diff-seconds 81360)) ; At least 22h 36m - (should (< time-diff-seconds 81480))))) ; At most 22h 38m - (test-chime-timestamp-parse-teardown))) + (with-test-time (encode-time 0 23 11 2 11 2025) ; Nov 02, 2025 11:23:00 AM + (let* ((tomorrow-timestamp "<2025-11-03 Mon 10:00-10:30>") + (parsed (chime--timestamp-parse tomorrow-timestamp)) + (now (current-time))) + ;; Should parse successfully + (should parsed) + ;; Convert parsed time (HIGH LOW) to full time by appending (0 0) + (let* ((parsed-time (append parsed '(0 0))) + (parsed-decoded (decode-time parsed-time)) + (time-diff-seconds (- (time-to-seconds parsed-time) + (time-to-seconds now)))) + ;; Verify the parsed date is Nov 03, 2025 (not Nov 02!) + (should (= 3 (decoded-time-day parsed-decoded))) + (should (= 11 (decoded-time-month parsed-decoded))) + (should (= 2025 (decoded-time-year parsed-decoded))) + ;; Verify the parsed time is 10:00 + (should (= 10 (decoded-time-hour parsed-decoded))) + (should (= 0 (decoded-time-minute parsed-decoded))) + ;; Time difference should be ~22h 37m (81420 seconds) + (should (> time-diff-seconds 81360)) ; At least 22h 36m + (should (< time-diff-seconds 81480)))))) ;;; Error Cases -(ert-deftest test-chime-timestamp-parse-empty-string-returns-nil () +(chime-deftest test-chime-timestamp-parse-empty-string-returns-nil () "Test that empty string returns nil." - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((timestamp "") - (result (chime--timestamp-parse timestamp))) - (should (null result))) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-nil-input-returns-nil () + (let* ((timestamp "") + (result (chime--timestamp-parse timestamp))) + (should (null result)))) + +(chime-deftest test-chime-timestamp-parse-nil-input-returns-nil () "Test that nil input returns nil." - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((timestamp nil) - (result (chime--timestamp-parse timestamp))) - (should (null result))) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-missing-opening-bracket-returns-nil () + (let* ((timestamp nil) + (result (chime--timestamp-parse timestamp))) + (should (null result)))) + +(chime-deftest test-chime-timestamp-parse-missing-opening-bracket-returns-nil () "Test that timestamp missing opening bracket returns nil." - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((timestamp "2025-10-24 Fri 14:00>") - (result (chime--timestamp-parse timestamp))) - (should (null result))) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-missing-closing-bracket-returns-nil () + (let* ((timestamp "2025-10-24 Fri 14:00>") + (result (chime--timestamp-parse timestamp))) + (should (null result)))) + +(chime-deftest test-chime-timestamp-parse-missing-closing-bracket-returns-nil () "Test that timestamp missing closing bracket returns nil." - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((timestamp "<2025-10-24 Fri 14:00") - (result (chime--timestamp-parse timestamp))) - (should (null result))) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-invalid-date-format-returns-nil () + (let* ((timestamp "<2025-10-24 Fri 14:00") + (result (chime--timestamp-parse timestamp))) + (should (null result)))) + +(chime-deftest test-chime-timestamp-parse-invalid-date-format-returns-nil () "Test that invalid date format returns nil." - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((timestamp "<10-24-2025 Fri 14:00>") - (result (chime--timestamp-parse timestamp))) - (should (null result))) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-invalid-month-returns-nil () + (let* ((timestamp "<10-24-2025 Fri 14:00>") + (result (chime--timestamp-parse timestamp))) + (should (null result)))) + +(chime-deftest test-chime-timestamp-parse-invalid-month-returns-nil () "Test that invalid month value returns nil." - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((timestamp "<2025-13-24 Fri 14:00>") - (result (chime--timestamp-parse timestamp))) - (should (null result))) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-invalid-day-returns-nil () + (let* ((timestamp "<2025-13-24 Fri 14:00>") + (result (chime--timestamp-parse timestamp))) + (should (null result)))) + +(chime-deftest test-chime-timestamp-parse-invalid-day-returns-nil () "Test that invalid day value returns nil." - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((timestamp "<2025-10-32 Fri 14:00>") - (result (chime--timestamp-parse timestamp))) - (should (null result))) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-invalid-time-hour-returns-nil () + (let* ((timestamp "<2025-10-32 Fri 14:00>") + (result (chime--timestamp-parse timestamp))) + (should (null result)))) + +(chime-deftest test-chime-timestamp-parse-invalid-time-hour-returns-nil () "Test that invalid hour value returns nil." - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((timestamp "<2025-10-24 Fri 25:00>") - (result (chime--timestamp-parse timestamp))) - (should (null result))) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-invalid-time-minute-returns-nil () + (let* ((timestamp "<2025-10-24 Fri 25:00>") + (result (chime--timestamp-parse timestamp))) + (should (null result)))) + +(chime-deftest test-chime-timestamp-parse-invalid-time-minute-returns-nil () "Test that invalid minute value returns nil." - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((timestamp "<2025-10-24 Fri 14:60>") - (result (chime--timestamp-parse timestamp))) - (should (null result))) - (test-chime-timestamp-parse-teardown))) - -(ert-deftest test-chime-timestamp-parse-date-only-no-time-returns-nil () + (let* ((timestamp "<2025-10-24 Fri 14:60>") + (result (chime--timestamp-parse timestamp))) + (should (null result)))) + +(chime-deftest test-chime-timestamp-parse-date-only-no-time-returns-nil () "Test that day-wide timestamp without time returns nil." - (test-chime-timestamp-parse-setup) - (unwind-protect - (let* ((timestamp "<2025-10-24 Fri>") - (result (chime--timestamp-parse timestamp))) - (should (null result))) - (test-chime-timestamp-parse-teardown))) + (let* ((timestamp "<2025-10-24 Fri>") + (result (chime--timestamp-parse timestamp))) + (should (null result)))) (provide 'test-chime-timestamp-parse) ;;; test-chime-timestamp-parse.el ends here |
