From a7b1a3163d36a7d715abcce096c60ec50bb40658 Mon Sep 17 00:00:00 2001 From: Robert Irelan Date: Tue, 26 Jun 2018 18:33:39 -0700 Subject: [PATCH 2/2] Add tests for clocktable behavior under org-extend-today-until --- testing/lisp/test-org-clock.el | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el index e85325c14..abb3637bd 100644 --- a/testing/lisp/test-org-clock.el +++ b/testing/lisp/test-org-clock.el @@ -979,5 +979,55 @@ CLOCK: [2017-12-27 Wed 08:00]--[2017-12-27 Wed 16:00] => 8:00" (concat ":step day :tstart \"<2017-12-25 Mon>\" " ":tend \"<2017-12-27 Wed 23:59>\" :stepskip0 t"))))))) +(ert-deftest test-org-clock/clocktable/extend-today-until () + "Test assignment of clock time to days in presence of \"org-extend-today-until\"." + ;; Basic test of :block with org-extend-today-until - the report for + ;; 2017-09-30 should include the time clocked on 2017-10-01 before + ;; 04:00. + (should + (equal "| Headline | Time | +|--------------+--------| +| *Total time* | *2:00* | +|--------------+--------| +| Foo | 2:00 |" + (org-test-with-temp-text + "* Foo +CLOCK: [2017-09-30 Sat 12:00]--[2017-09-30 Sat 13:00] => 1:00 +CLOCK: [2017-10-01 Sun 02:00]--[2017-10-01 Sun 03:00] => 1:00 +CLOCK: [2017-10-01 Sun 11:00]--[2017-10-01 Sun 13:00] => 2:00" + (setq-local org-extend-today-until 4) + (let ((system-time-locale "en_US")) + (test-org-clock-clocktable-contents + ":block 2017-09-30"))))) + + ;; Week-length block - time on Monday before 04:00 should be + ;; assigned to previous week. + (should + (equal " +Weekly report starting on: [2017-10-01 Sun] +| Headline | Time | +|--------------+--------| +| *Total time* | *2:00* | +|--------------+--------| +| Foo | 2:00 | + +Weekly report starting on: [2017-10-02 Mon] +| Headline | Time | +|--------------+--------| +| *Total time* | *2:00* | +|--------------+--------| +| Foo | 2:00 | +" + (org-test-with-temp-text + "* Foo +CLOCK: [2017-10-01 Sun 12:00]--[2017-10-01 Sun 13:00] => 1:00 +CLOCK: [2017-10-02 Mon 02:00]--[2017-10-02 Mon 03:00] => 1:00 +CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 13:00] => 2:00" + (setq-local org-extend-today-until 4) + (let ((system-time-locale "en_US")) + (test-org-clock-clocktable-contents + ":step week :block 2017-10 :stepskip0 t")))))) + + (provide 'test-org-clock) ;;; test-org-clock.el end here -- 2.18.0.rc2.346.g013aa6912e-goog