From 475c8a75c09efb36be9b918520c99d9ab8c374a1 Mon Sep 17 00:00:00 2001 From: Morgan Smith Date: Fri, 14 Jun 2024 10:08:19 -0400 Subject: [PATCH 2/2] malformed clock tests --- testing/lisp/test-org-element.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index 6a4ec6c22..12d694226 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -1148,6 +1148,7 @@ CLOCK: [2023-10-13 Fri 14:40]--[2023-10-13 Fri 14:51] => 0:11" (ert-deftest test-org-element/clock-parser () "Test `clock' parser." + ;; TODO: does not check time information like :year-start etc!!! ;; Running clock. (let ((clock (org-test-with-temp-text "CLOCK: [2012-01-01 sun. 00:01]" (org-element-at-point)))) @@ -1183,7 +1184,18 @@ CLOCK: [2023-10-13 Fri 14:40]--[2023-10-13 Fri 14:51] => 0:11" (org-element-at-point)))) (should (eq (org-element-property :status clock) 'closed)) (should-not (org-element-property :value clock)) - (should (equal (org-element-property :duration clock) "0:11")))) + (should (equal (org-element-property :duration clock) "0:11"))) + ;; malformed clocks + ;; TODO: should probably emit warning or something!! + (let ((clock + (org-test-with-temp-text + "CLOCK: [2012-01-01 sun. 00rr:01]--[2012-01-01 sun. 00:02] => 0:01" + (org-element-at-point)))) + (should (eq (org-element-property :status clock) 'closed)) + (should (equal (org-element-property :raw-value + (org-element-property :value clock)) + "[2012-01-01 sun. 00rr:01]--[2012-01-01 sun. 00:02]")) + (should (equal (org-element-property :duration clock) "0:01")))) ;;;; Code -- 2.45.1