diff --git a/site-lisp/timeline-tools-test.el b/site-lisp/timeline-tools-test.el index dbe6d92..2de4ed6 100644 --- a/site-lisp/timeline-tools-test.el +++ b/site-lisp/timeline-tools-test.el @@ -202,8 +202,9 @@ CLOCK: [2018-01-08 Mon 16:00]--[2018-01-08 Mon 16:15] => 0:15 (ert-deftest timeline-tools-test-clockline-no-conflict-1 () "Test `timeline-tools-clockline-no-conflict’ with complex example." - (with-temp-buffer - (insert " + (let ((system-time-locale "C")) + (with-temp-buffer + (insert " * Task 1 :LOGBOOK: CLOCK: [2018-01-07 Sun 13:15]--[2018-01-07 Sun 14:00] => 0:45 @@ -233,13 +234,14 @@ CLOCK: [2018-01-11 Thu 13:33]--[2018-01-12 Fri 14:00] => 24:27 * Task 2 :LOGBOOK: :END: -")))) +"))))) (ert-deftest timeline-tools-test-add-clockline-to-marker-1 () "Test `timeline-tools-add-clockline-to-marker’ without running clock." - (with-temp-buffer - (insert " + (let ((system-time-locale "C")) + (with-temp-buffer + (insert " * Task 1 :LOGBOOK: CLOCK: [2018-01-07 Sun 13:15]--[2018-01-07 Sun 14:00] => 0:45 @@ -253,16 +255,16 @@ CLOCK: [2018-01-07 Sun 15:13]--[2018-01-07 Sun 16:17] => 1:04 CLOCK: [2018-01-08 Mon 16:00]--[2018-01-08 Mon 16:15] => 0:15 :END: ") - (org-mode) - (goto-char 216) - (let ((result (timeline-tools-add-clockline-to-marker - (point-marker) - (org-time-string-to-seconds "[2018-01-07 Sun 13:00]") - (org-time-string-to-seconds "[2018-01-11 Thu 13:33]")))) + (org-mode) + (goto-char 216) + (let ((result (timeline-tools-add-clockline-to-marker + (point-marker) + (org-time-string-to-seconds "[2018-01-07 Sun 13:00]") + (org-time-string-to-seconds "[2018-01-11 Thu 13:33]")))) - (should (null result)) - (should (equal (buffer-string) - " + (should (null result)) + (should (equal (buffer-string) + " * Task 1 :LOGBOOK: CLOCK: [2018-01-11 Thu 13:33]--[2018-01-12 Fri 14:00] => 24:27 @@ -272,13 +274,14 @@ CLOCK: [2018-01-11 Thu 13:33]--[2018-01-12 Fri 14:00] => 24:27 :LOGBOOK: CLOCK: [2018-01-07 Sun 13:00]--[2018-01-11 Thu 13:33] => 96:33 :END: -"))))) +")))))) (ert-deftest timeline-tools-test-add-clockline-to-marker-2 () "Test `timeline-tools-add-clockline-to-marker’ with running clock at same task." - (with-temp-buffer - (insert " + (let ((system-time-locale "C")) + (with-temp-buffer + (insert " * Task 1 :LOGBOOK: CLOCK: [2018-01-10 Wed 10:07]--[2018-01-12 Fri 14:00] => 51:53 @@ -293,22 +296,22 @@ CLOCK: [2018-01-08 Mon 16:00]--[2018-01-08 Mon 16:15] => 0:15 CLOCK: [2018-01-07 Sun 15:13]--[2018-01-07 Sun 16:17] => 1:04 :END: ") - (org-mode) - (let (;; simulate running clock at Task 2 - (org-clock-hd-marker (progn (goto-char 216) (point-marker))) - (org-clock-marker (progn (goto-char 264) (point-marker))) - (org-clock-start-time (org-time-string-to-time "[2018-01-10 Wed 13:10]"))) - (let ((result (timeline-tools-add-clockline-to-marker - org-clock-hd-marker - (org-time-string-to-seconds "[2018-01-07 Sun 13:00]") - (org-time-string-to-seconds "[2018-01-11 Thu 13:33]")))) + (org-mode) + (let (;; simulate running clock at Task 2 + (org-clock-hd-marker (progn (goto-char 216) (point-marker))) + (org-clock-marker (progn (goto-char 264) (point-marker))) + (org-clock-start-time (org-time-string-to-time "[2018-01-10 Wed 13:10]"))) + (let ((result (timeline-tools-add-clockline-to-marker + org-clock-hd-marker + (org-time-string-to-seconds "[2018-01-07 Sun 13:00]") + (org-time-string-to-seconds "[2018-01-11 Thu 13:33]")))) - (should (null result)) - (should (equal org-clock-start-time - (append (org-time-string-to-time "[2018-01-11 Thu 13:33]") - '(0 0)))) - (should (equal (buffer-string) - " + (should (null result)) + (should (equal org-clock-start-time + (append (org-time-string-to-time "[2018-01-11 Thu 13:33]") + '(0 0)))) + (should (equal (buffer-string) + " * Task 1 :LOGBOOK: CLOCK: [2018-01-11 Thu 13:33]--[2018-01-12 Fri 14:00] => 24:27 @@ -319,13 +322,14 @@ CLOCK: [2018-01-11 Thu 13:33]--[2018-01-12 Fri 14:00] => 24:27 CLOCK: [2018-01-11 Thu 13:33] CLOCK: [2018-01-07 Sun 13:00]--[2018-01-11 Thu 13:33] => 96:33 :END: -")))))) +"))))))) (ert-deftest timeline-tools-test-add-clockline-to-marker-3 () "Test `timeline-tools-add-clockline-to-marker’ with running clock at same task." - (with-temp-buffer - (insert " + (let ((system-time-locale "C")) + (with-temp-buffer + (insert " * Task 1 :LOGBOOK: CLOCK: [2018-01-08 Mon 16:15]--[2018-01-10 Wed 13:10] => 44:55 @@ -339,22 +343,22 @@ CLOCK: [2018-01-08 Mon 16:00]--[2018-01-08 Mon 16:15] => 0:15 CLOCK: [2018-01-07 Sun 15:13]--[2018-01-07 Sun 16:17] => 1:04 :END: ") - (org-mode) - (let (;; simulate running clock at Task 2 - (org-clock-hd-marker (progn (goto-char 153) (point-marker))) - (org-clock-marker (progn (goto-char 201) (point-marker))) - (org-clock-start-time (org-time-string-to-time "[2018-01-10 Wed 13:10]"))) - (let ((result (timeline-tools-add-clockline-to-marker - (progn (goto-char 2) (point-marker)) - (org-time-string-to-seconds "[2018-01-07 Sun 13:00]") - (org-time-string-to-seconds "[2018-01-11 Thu 13:33]")))) + (org-mode) + (let (;; simulate running clock at Task 2 + (org-clock-hd-marker (progn (goto-char 153) (point-marker))) + (org-clock-marker (progn (goto-char 201) (point-marker))) + (org-clock-start-time (org-time-string-to-time "[2018-01-10 Wed 13:10]"))) + (let ((result (timeline-tools-add-clockline-to-marker + (progn (goto-char 2) (point-marker)) + (org-time-string-to-seconds "[2018-01-07 Sun 13:00]") + (org-time-string-to-seconds "[2018-01-11 Thu 13:33]")))) - (should (null result)) - (should (equal org-clock-start-time - (append (org-time-string-to-time "[2018-01-11 Thu 13:33]") - '(0 0)))) - (should (equal (buffer-string) - " + (should (null result)) + (should (equal org-clock-start-time + (append (org-time-string-to-time "[2018-01-11 Thu 13:33]") + '(0 0)))) + (should (equal (buffer-string) + " * Task 1 :LOGBOOK: CLOCK: [2018-01-07 Sun 13:00]--[2018-01-11 Thu 13:33] => 96:33 @@ -364,14 +368,15 @@ CLOCK: [2018-01-07 Sun 13:00]--[2018-01-11 Thu 13:33] => 96:33 :LOGBOOK: CLOCK: [2018-01-11 Thu 13:33] :END: -")))))) +"))))))) (ert-deftest timeline-tools-test-add-clockline-to-marker-4 () "Test `timeline-tools-add-clockline-to-marker’ with running clock at other task, and where afterwards only the running clock line is left." - (with-temp-buffer - (insert " + (let ((system-time-locale "C")) + (with-temp-buffer + (insert " * Task 1 :LOGBOOK: CLOCK: [2018-01-10 Wed 10:07]--[2018-01-12 Fri 14:00] => 51:53 @@ -386,22 +391,22 @@ CLOCK: [2018-01-08 Mon 16:00]--[2018-01-08 Mon 16:15] => 0:15 CLOCK: [2018-01-07 Sun 15:13]--[2018-01-07 Sun 16:17] => 1:04 :END: ") - (org-mode) - (let (;; simulate running clock at Task 2 - (org-clock-hd-marker (progn (goto-char 216) (point-marker))) - (org-clock-marker (progn (goto-char 264) (point-marker))) - (org-clock-start-time (org-time-string-to-time "[2018-01-10 Wed 13:10]"))) - (let ((result (timeline-tools-add-clockline-to-marker - (progn (goto-char 2) (point-marker)) - (org-time-string-to-seconds "[2018-01-07 Sun 13:00]") - (org-time-string-to-seconds "[2018-01-11 Thu 13:33]")))) + (org-mode) + (let (;; simulate running clock at Task 2 + (org-clock-hd-marker (progn (goto-char 216) (point-marker))) + (org-clock-marker (progn (goto-char 264) (point-marker))) + (org-clock-start-time (org-time-string-to-time "[2018-01-10 Wed 13:10]"))) + (let ((result (timeline-tools-add-clockline-to-marker + (progn (goto-char 2) (point-marker)) + (org-time-string-to-seconds "[2018-01-07 Sun 13:00]") + (org-time-string-to-seconds "[2018-01-11 Thu 13:33]")))) - (should (null result)) - (should (equal org-clock-start-time - (append (org-time-string-to-time "[2018-01-11 Thu 13:33]") - '(0 0)))) - (should (equal (buffer-string) - " + (should (null result)) + (should (equal org-clock-start-time + (append (org-time-string-to-time "[2018-01-11 Thu 13:33]") + '(0 0)))) + (should (equal (buffer-string) + " * Task 1 :LOGBOOK: CLOCK: [2018-01-07 Sun 13:00]--[2018-01-11 Thu 13:33] => 96:33 @@ -412,6 +417,6 @@ CLOCK: [2018-01-11 Thu 13:33]--[2018-01-12 Fri 14:00] => 24:27 :LOGBOOK: CLOCK: [2018-01-11 Thu 13:33] :END: -")))))) +"))))))) ;;; timeline-tools-test.el ends here