From b7cb1c51e5663419344d8b55766635801f3ee4c8 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 5 Feb 2026 15:13:57 -0600 Subject: =?UTF-8?q?feat(calendar-sync):=20add=20event=20details=20?= =?UTF-8?q?=E2=80=94=20attendees,=20organizer,=20status,=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add ICS text unescaping (RFC 5545), HTML stripping, and new fields (attendees/status, organizer, meeting URL) to calendar-sync.el. event-to-org now outputs org property drawers. 88 new tests across 10 test files, 146/146 pass. Also fix pre-existing test require order and keymap guard issues. --- tests/test-calendar-sync--unescape-ics-text.el | 79 ++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 tests/test-calendar-sync--unescape-ics-text.el (limited to 'tests/test-calendar-sync--unescape-ics-text.el') diff --git a/tests/test-calendar-sync--unescape-ics-text.el b/tests/test-calendar-sync--unescape-ics-text.el new file mode 100644 index 00000000..a83e97d3 --- /dev/null +++ b/tests/test-calendar-sync--unescape-ics-text.el @@ -0,0 +1,79 @@ +;;; test-calendar-sync--unescape-ics-text.el --- Tests for ICS text unescaping -*- lexical-binding: t; -*- + +;;; Commentary: +;; Unit tests for calendar-sync--unescape-ics-text function. +;; RFC 5545 defines escape sequences: \n→newline, \,→comma, \\→backslash, \;→semicolon. +;; Covers Normal, Boundary, and Error cases. + +;;; Code: + +(require 'ert) +(require 'testutil-calendar-sync) +(require 'calendar-sync) + +;;; Normal Cases + +(ert-deftest test-calendar-sync--unescape-ics-text-normal-newline () + "Test \\n escape is converted to actual newline." + (should (string= "line1\nline2" + (calendar-sync--unescape-ics-text "line1\\nline2")))) + +(ert-deftest test-calendar-sync--unescape-ics-text-normal-comma () + "Test \\, escape is converted to comma." + (should (string= "one, two" + (calendar-sync--unescape-ics-text "one\\, two")))) + +(ert-deftest test-calendar-sync--unescape-ics-text-normal-backslash () + "Test \\\\ escape is converted to single backslash." + (should (string= "path\\file" + (calendar-sync--unescape-ics-text "path\\\\file")))) + +(ert-deftest test-calendar-sync--unescape-ics-text-normal-semicolon () + "Test \\; escape is converted to semicolon." + (should (string= "a;b" + (calendar-sync--unescape-ics-text "a\\;b")))) + +(ert-deftest test-calendar-sync--unescape-ics-text-normal-mixed () + "Test multiple different escapes in one string." + (should (string= "Hello, World\nPath\\to;file" + (calendar-sync--unescape-ics-text "Hello\\, World\\nPath\\\\to\\;file")))) + +;;; Boundary Cases + +(ert-deftest test-calendar-sync--unescape-ics-text-boundary-empty-string () + "Test empty string returns empty string." + (should (string= "" (calendar-sync--unescape-ics-text "")))) + +(ert-deftest test-calendar-sync--unescape-ics-text-boundary-no-escapes () + "Test string with no escapes passes through unchanged." + (should (string= "plain text" + (calendar-sync--unescape-ics-text "plain text")))) + +(ert-deftest test-calendar-sync--unescape-ics-text-boundary-escape-at-start () + "Test escape sequence at string start." + (should (string= "\nfoo" + (calendar-sync--unescape-ics-text "\\nfoo")))) + +(ert-deftest test-calendar-sync--unescape-ics-text-boundary-escape-at-end () + "Test escape sequence at string end." + (should (string= "foo\n" + (calendar-sync--unescape-ics-text "foo\\n")))) + +(ert-deftest test-calendar-sync--unescape-ics-text-boundary-consecutive-escapes () + "Test consecutive escape sequences." + (should (string= "\n\n" + (calendar-sync--unescape-ics-text "\\n\\n")))) + +(ert-deftest test-calendar-sync--unescape-ics-text-boundary-only-escapes () + "Test string composed entirely of escapes." + (should (string= ",;\n\\" + (calendar-sync--unescape-ics-text "\\,\\;\\n\\\\")))) + +;;; Error Cases + +(ert-deftest test-calendar-sync--unescape-ics-text-error-nil-input () + "Test nil input returns nil." + (should (null (calendar-sync--unescape-ics-text nil)))) + +(provide 'test-calendar-sync--unescape-ics-text) +;;; test-calendar-sync--unescape-ics-text.el ends here -- cgit v1.2.3