From ac552d5cc534cda5f3726c5848ed0162ca4cfd53 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 19 Jun 2026 09:56:20 -0400 Subject: test: cover pure-logic gaps found by the coverage audit I ran make coverage and worked the report function by function, separating real gaps from interactive/IO wrappers that aren't unit-test targets. These tests fill the genuine pure-logic holes: predicates, parsers, formatters, transforms, and three modules that had no test file at all. New files cover car-member (local-repository), show-kill-insert-item (show-kill-ring), the oauth2-auto plstore cache fix (auth-config), the coverage-core project-root fallback, reconcile--dirty-p, and the recurrence-frequency dispatch in calendar-sync. Extended files add the missing branches: coverage-core's merge-base and diff /dev/null handling plus the staged and branch-vs-main scopes, the detect-system-timezone symlink path, user-constants no-op and optional-failure branches, the elfeed playlist branch with HTML-entity decoding, the duplicate-line no-comment-syntax guard, and several calendar-sync edges (exception field overrides, timestamp seconds and TZID fallback, property-line position advancement, parse-ics nil and out-of-range inputs). Mocks sit at the real boundaries (plstore, url-retrieve, process-file, git) so each function's own logic runs. Dates come from relative helpers. About 65 tests added across 15 files, and the full suite stays green. --- tests/test-calendar-sync--parse-timestamp.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/test-calendar-sync--parse-timestamp.el') diff --git a/tests/test-calendar-sync--parse-timestamp.el b/tests/test-calendar-sync--parse-timestamp.el index d05540f7c..6a56ba9e2 100644 --- a/tests/test-calendar-sync--parse-timestamp.el +++ b/tests/test-calendar-sync--parse-timestamp.el @@ -55,5 +55,28 @@ "Truncated datetime returns nil." (should (null (calendar-sync--parse-timestamp "2026031")))) +;;; Boundary / Error — second capture, TZID fallback, leap day + +(ert-deftest test-calendar-sync--parse-timestamp-utc-passes-nonzero-seconds () + "Boundary: the seconds field is captured and passed to the UTC converter." + (cl-letf (((symbol-function 'calendar-sync--convert-utc-to-local) + (lambda (y mo d h mi s) (list 'utc y mo d h mi s)))) + (should (equal (calendar-sync--parse-timestamp "20260315T180045Z") + '(utc 2026 3 15 18 0 45))))) + +(ert-deftest test-calendar-sync--parse-timestamp-tzid-fallback-on-failure () + "Error: when TZID conversion fails, the raw 5-tuple is returned." + (cl-letf (((symbol-function 'calendar-sync--convert-tz-to-local) + (lambda (&rest _) nil))) + (should (equal (calendar-sync--parse-timestamp "20260315T180000" "Fake/Zone") + '(2026 3 15 18 0))))) + +(ert-deftest test-calendar-sync--parse-timestamp-leap-day-components () + "Boundary: a valid leap day (2024-02-29) is parsed into its components." + (cl-letf (((symbol-function 'calendar-sync--convert-utc-to-local) + (lambda (y mo d h mi s) (list y mo d h mi s)))) + (should (equal (calendar-sync--parse-timestamp "20240229T120000Z") + '(2024 2 29 12 0 0))))) + (provide 'test-calendar-sync--parse-timestamp) ;;; test-calendar-sync--parse-timestamp.el ends here -- cgit v1.2.3