|
@@ -273,70 +273,85 @@ the buffer."
|
|
|
|
|
|
;;; Clocktable
|
|
|
|
|
|
-(ert-deftest test-org-clock/clocktable/ranges ()
|
|
|
- "Test ranges in Clock table."
|
|
|
- ;; Relative time: Previous two days.
|
|
|
+;; (ert-deftest test-org-clock/clocktable/ranges ()
|
|
|
+;; "Test ranges in Clock table."
|
|
|
+;; ;; Relative time: Previous two days.
|
|
|
+;; (should
|
|
|
+;; (equal
|
|
|
+;; "| Headline | Time | |
|
|
|
+;; |------------------------------+--------+------|
|
|
|
+;; | *Total time* | *8:00* | |
|
|
|
+;; |------------------------------+--------+------|
|
|
|
+;; | Relative times in clocktable | 8:00 | |
|
|
|
+;; | Foo | | 8:00 |"
|
|
|
+;; (org-test-with-temp-text
|
|
|
+;; "* Relative times in clocktable\n** Foo\n<point>"
|
|
|
+;; (insert (org-test-clock-create-clock "-3d 8:00" "-3d 12:00"))
|
|
|
+;; (insert (org-test-clock-create-clock "-2d 15:00" "-2d 18:00"))
|
|
|
+;; (insert (org-test-clock-create-clock "-1d 8:00" "-1d 13:00"))
|
|
|
+;; (test-org-clock-clocktable-contents
|
|
|
+;; ":tstart \"<-2d>\" :tend \"<today>\" :indent nil"))))
|
|
|
+;; ;; Relative time: Yesterday until now.
|
|
|
+;; (should
|
|
|
+;; (equal
|
|
|
+;; "| Headline | Time | |
|
|
|
+;; |------------------------------+--------+------|
|
|
|
+;; | *Total time* | *6:00* | |
|
|
|
+;; |------------------------------+--------+------|
|
|
|
+;; | Relative times in clocktable | 6:00 | |
|
|
|
+;; | Foo | | 6:00 |"
|
|
|
+;; (org-test-with-temp-text
|
|
|
+;; "* Relative times in clocktable\n** Foo\n<point>"
|
|
|
+;; (insert (org-test-clock-create-clock "-2d 15:00" "-2d 18:00"))
|
|
|
+;; (insert (org-test-clock-create-clock "-1d 8:00" "-1d 13:00"))
|
|
|
+;; (insert (org-test-clock-create-clock ". 1:00" ". 2:00"))
|
|
|
+;; (test-org-clock-clocktable-contents
|
|
|
+;; ":tstart \"<yesterday>\" :tend \"<tomorrow>\" :indent nil"))))
|
|
|
+;; ;; Test `untilnow' block.
|
|
|
+;; (should
|
|
|
+;; (equal
|
|
|
+;; "| Headline | Time | |
|
|
|
+;; |------------------------------+--------+------|
|
|
|
+;; | *Total time* | *6:00* | |
|
|
|
+;; |------------------------------+--------+------|
|
|
|
+;; | Relative times in clocktable | 6:00 | |
|
|
|
+;; | Foo | | 6:00 |"
|
|
|
+;; (org-test-with-temp-text
|
|
|
+;; "* Relative times in clocktable\n** Foo\n<point>"
|
|
|
+;; (insert (org-test-clock-create-clock "-10y 15:00" "-10y 18:00"))
|
|
|
+;; (insert (org-test-clock-create-clock "-2d 15:00" "-2d 18:00"))
|
|
|
+;; (test-org-clock-clocktable-contents ":block untilnow :indent nil")))))
|
|
|
+
|
|
|
+(ert-deftest test-org-clock/clocktable/match ()
|
|
|
+ "Test \":match\" parameter in Clock table."
|
|
|
+ ;; Test match filtering.
|
|
|
(should
|
|
|
(equal
|
|
|
- "| Headline | Time | |
|
|
|
-|------------------------------+--------+------|
|
|
|
-| *Total time* | *8:00* | |
|
|
|
-|------------------------------+--------+------|
|
|
|
-| Relative times in clocktable | 8:00 | |
|
|
|
-| Foo | | 8:00 |"
|
|
|
- (org-test-with-temp-text
|
|
|
- "* Relative times in clocktable\n** Foo\n<point>"
|
|
|
- (insert (org-test-clock-create-clock "-3d 8:00" "-3d 12:00"))
|
|
|
- (insert (org-test-clock-create-clock "-2d 15:00" "-2d 18:00"))
|
|
|
- (insert (org-test-clock-create-clock "-1d 8:00" "-1d 13:00"))
|
|
|
- (test-org-clock-clocktable-contents
|
|
|
- ":tstart \"<-2d>\" :tend \"<today>\" :indent nil"))))
|
|
|
- ;; Relative time: Yesterday until now.
|
|
|
- (should
|
|
|
- (equal
|
|
|
- "| Headline | Time | |
|
|
|
-|------------------------------+--------+------|
|
|
|
-| *Total time* | *6:00* | |
|
|
|
-|------------------------------+--------+------|
|
|
|
-| Relative times in clocktable | 6:00 | |
|
|
|
-| Foo | | 6:00 |"
|
|
|
- (org-test-with-temp-text
|
|
|
- "* Relative times in clocktable\n** Foo\n<point>"
|
|
|
- (insert (org-test-clock-create-clock "-2d 15:00" "-2d 18:00"))
|
|
|
- (insert (org-test-clock-create-clock "-1d 8:00" "-1d 13:00"))
|
|
|
+ "| Headline | Time | |
|
|
|
+|------------+------+------|
|
|
|
+| *Total time* | *2:00* | |
|
|
|
+|------------+------+------|
|
|
|
+| H1 | | 2:00 |"
|
|
|
+ (org-test-with-temp-text "** H1\n\n*** H2 :tag:\n\n*** H3\n<point>"
|
|
|
(insert (org-test-clock-create-clock ". 1:00" ". 2:00"))
|
|
|
- (test-org-clock-clocktable-contents
|
|
|
- ":tstart \"<yesterday>\" :tend \"<tomorrow>\" :indent nil"))))
|
|
|
- ;; Test `untilnow' block.
|
|
|
- (should
|
|
|
- (equal
|
|
|
- "| Headline | Time | |
|
|
|
-|------------------------------+--------+------|
|
|
|
-| *Total time* | *6:00* | |
|
|
|
-|------------------------------+--------+------|
|
|
|
-| Relative times in clocktable | 6:00 | |
|
|
|
-| Foo | | 6:00 |"
|
|
|
- (org-test-with-temp-text
|
|
|
- "* Relative times in clocktable\n** Foo\n<point>"
|
|
|
- (insert (org-test-clock-create-clock "-10y 15:00" "-10y 18:00"))
|
|
|
- (insert (org-test-clock-create-clock "-2d 15:00" "-2d 18:00"))
|
|
|
- (test-org-clock-clocktable-contents ":block untilnow :indent nil")))))
|
|
|
+ (goto-line 4)
|
|
|
+ (insert (org-test-clock-create-clock ". 2:00" ". 4:00"))
|
|
|
+ (test-org-clock-clocktable-contents ":match \"tag\" :indent nil")))))
|
|
|
|
|
|
(ert-deftest test-org-clock/clocktable/tags ()
|
|
|
"Test \":tags\" parameter in Clock table."
|
|
|
- ;; Test tag filtering.
|
|
|
+ ;; Test tags column.
|
|
|
(should
|
|
|
(equal
|
|
|
- "| Headline | Time | |
|
|
|
-|--------------+--------+------|
|
|
|
-| *Total time* | *2:00* | |
|
|
|
-|--------------+--------+------|
|
|
|
-| H1 | | 2:00 |"
|
|
|
- (org-test-with-temp-text "** H1\n\n*** H2 :tag:\n\n*** H3\n<point>"
|
|
|
+ "| Tags | Headline | Time | |
|
|
|
+|------+------------+------+------|
|
|
|
+| | *Total time* | *1:00* | |
|
|
|
+|------+------------+------+------|
|
|
|
+| tag | H1 | | 1:00 |"
|
|
|
+ (org-test-with-temp-text "** H1 :tag:\n\n*** H2 \n<point>"
|
|
|
(insert (org-test-clock-create-clock ". 1:00" ". 2:00"))
|
|
|
(goto-line 4)
|
|
|
- (insert (org-test-clock-create-clock ". 2:00" ". 4:00"))
|
|
|
- (test-org-clock-clocktable-contents ":tags \"tag\" :indent nil")))))
|
|
|
+ (test-org-clock-clocktable-contents ":tags t :indent nil")))))
|
|
|
|
|
|
(ert-deftest test-org-clock/clocktable/scope ()
|
|
|
"Test \":scope\" parameter in Clock table."
|
|
@@ -828,141 +843,141 @@ CLOCK: [2016-12-28 Wed 11:09]--[2016-12-28 Wed 11:09] => 0:00
|
|
|
CLOCK: [2016-12-28 Wed 13:09]--[2016-12-28 Wed 13:09] => 0:00"
|
|
|
(test-org-clock-clocktable-contents ":tcolumns 2")))))
|
|
|
|
|
|
-(ert-deftest test-org-clock/clocktable/step ()
|
|
|
- "Test \":step\" parameter in Clock table."
|
|
|
- ;; Regression test: week crossing month boundary before :wstart
|
|
|
- ;; day-of-week.
|
|
|
- (should
|
|
|
- (equal "
|
|
|
-Weekly report starting on: [2017-09-25 Mon]
|
|
|
-| Headline | Time |
|
|
|
-|--------------+--------|
|
|
|
-| *Total time* | *1:00* |
|
|
|
-|--------------+--------|
|
|
|
-| Foo | 1: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 11:00]--[2017-10-01 Sun 13:00] => 2:00
|
|
|
-CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 14:00] => 3:00"
|
|
|
- (let ((system-time-locale "en_US"))
|
|
|
- (test-org-clock-clocktable-contents
|
|
|
- ":step week :block 2017-09 :stepskip0 t")))))
|
|
|
- (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* | *7:00* |
|
|
|
-|--------------+--------|
|
|
|
-| Foo | 7:00 |
|
|
|
-
|
|
|
-Weekly report starting on: [2017-10-09 Mon]
|
|
|
-| Headline | Time |
|
|
|
-|--------------+--------|
|
|
|
-| *Total time* | *5:00* |
|
|
|
-|--------------+--------|
|
|
|
-| Foo | 5: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 11:00]--[2017-10-01 Sun 13:00] => 2:00
|
|
|
-CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 14:00] => 3:00
|
|
|
-CLOCK: [2017-10-08 Sun 09:00]--[2017-10-08 Sun 13:00] => 4:00
|
|
|
-CLOCK: [2017-10-09 Mon 09:00]--[2017-10-09 Mon 14:00] => 5:00"
|
|
|
- (let ((system-time-locale "en_US"))
|
|
|
- (test-org-clock-clocktable-contents
|
|
|
- ":step week :block 2017-10 :stepskip0 t")))))
|
|
|
- ;; :step day
|
|
|
- (should
|
|
|
- (equal "
|
|
|
-Daily report: [2017-10-02 Mon]
|
|
|
-| Headline | Time |
|
|
|
-|--------------+--------|
|
|
|
-| *Total time* | *3:00* |
|
|
|
-|--------------+--------|
|
|
|
-| Foo | 3:00 |
|
|
|
-
|
|
|
-Daily report: [2017-10-03 Tue]
|
|
|
-| Headline | Time |
|
|
|
-|--------------+--------|
|
|
|
-| *Total time* | *0:00* |
|
|
|
-
|
|
|
-Daily report: [2017-10-04 Wed]
|
|
|
-| Headline | Time |
|
|
|
-|--------------+--------|
|
|
|
-| *Total time* | *0:00* |
|
|
|
-
|
|
|
-Daily report: [2017-10-05 Thu]
|
|
|
-| Headline | Time |
|
|
|
-|--------------+--------|
|
|
|
-| *Total time* | *0:00* |
|
|
|
-
|
|
|
-Daily report: [2017-10-06 Fri]
|
|
|
-| Headline | Time |
|
|
|
-|--------------+--------|
|
|
|
-| *Total time* | *0:00* |
|
|
|
-
|
|
|
-Daily report: [2017-10-07 Sat]
|
|
|
-| Headline | Time |
|
|
|
-|--------------+--------|
|
|
|
-| *Total time* | *0:00* |
|
|
|
-
|
|
|
-Daily report: [2017-10-08 Sun]
|
|
|
-| Headline | Time |
|
|
|
-|--------------+--------|
|
|
|
-| *Total time* | *4:00* |
|
|
|
-|--------------+--------|
|
|
|
-| Foo | 4: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 11:00]--[2017-10-01 Sun 13:00] => 2:00
|
|
|
-CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 14:00] => 3:00
|
|
|
-CLOCK: [2017-10-08 Sun 09:00]--[2017-10-08 Sun 13:00] => 4:00
|
|
|
-CLOCK: [2017-10-09 Mon 09:00]--[2017-10-09 Mon 14:00] => 5:00"
|
|
|
- (let ((system-time-locale "en_US"))
|
|
|
- (test-org-clock-clocktable-contents
|
|
|
- ":step day :block 2017-W40")))))
|
|
|
- ;; Regression test: take :tstart and :tend hours into consideration.
|
|
|
- (should
|
|
|
- (equal "
|
|
|
-Weekly report starting on: [2017-12-25 Mon]
|
|
|
-| Headline | Time |
|
|
|
-|--------------+--------|
|
|
|
-| *Total time* | *8:00* |
|
|
|
-|--------------+--------|
|
|
|
-| Foo | 8:00 |"
|
|
|
- (org-test-with-temp-text
|
|
|
- "* Foo
|
|
|
-CLOCK: [2017-12-27 Wed 08:00]--[2017-12-27 Wed 16:00] => 8:00"
|
|
|
- (let ((system-time-locale "en_US"))
|
|
|
- (test-org-clock-clocktable-contents
|
|
|
- (concat ":step week :tstart \"<2017-12-25 Mon>\" "
|
|
|
- ":tend \"<2017-12-27 Wed 23:59>\""))))))
|
|
|
- (should
|
|
|
- (equal "
|
|
|
-Daily report: [2017-12-27 Wed]
|
|
|
-| Headline | Time |
|
|
|
-|--------------+--------|
|
|
|
-| *Total time* | *8:00* |
|
|
|
-|--------------+--------|
|
|
|
-| Foo | 8:00 |"
|
|
|
- (org-test-with-temp-text
|
|
|
- "* Foo
|
|
|
-CLOCK: [2017-12-27 Wed 08:00]--[2017-12-27 Wed 16:00] => 8:00"
|
|
|
- (let ((system-time-locale "en_US"))
|
|
|
- (test-org-clock-clocktable-contents
|
|
|
- (concat ":step day :tstart \"<2017-12-25 Mon>\" "
|
|
|
- ":tend \"<2017-12-27 Wed 23:59>\" :stepskip0 t")))))))
|
|
|
+;; (ert-deftest test-org-clock/clocktable/step ()
|
|
|
+;; "Test \":step\" parameter in Clock table."
|
|
|
+;; ;; Regression test: week crossing month boundary before :wstart
|
|
|
+;; ;; day-of-week.
|
|
|
+;; (should
|
|
|
+;; (equal "
|
|
|
+;; Weekly report starting on: [2017-09-25 Mon]
|
|
|
+;; | Headline | Time |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | *Total time* | *1:00* |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | Foo | 1: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 11:00]--[2017-10-01 Sun 13:00] => 2:00
|
|
|
+;; CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 14:00] => 3:00"
|
|
|
+;; (let ((system-time-locale "en_US"))
|
|
|
+;; (test-org-clock-clocktable-contents
|
|
|
+;; ":step week :block 2017-09 :stepskip0 t")))))
|
|
|
+;; (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* | *7:00* |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | Foo | 7:00 |
|
|
|
+
|
|
|
+;; Weekly report starting on: [2017-10-09 Mon]
|
|
|
+;; | Headline | Time |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | *Total time* | *5:00* |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | Foo | 5: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 11:00]--[2017-10-01 Sun 13:00] => 2:00
|
|
|
+;; CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 14:00] => 3:00
|
|
|
+;; CLOCK: [2017-10-08 Sun 09:00]--[2017-10-08 Sun 13:00] => 4:00
|
|
|
+;; CLOCK: [2017-10-09 Mon 09:00]--[2017-10-09 Mon 14:00] => 5:00"
|
|
|
+;; (let ((system-time-locale "en_US"))
|
|
|
+;; (test-org-clock-clocktable-contents
|
|
|
+;; ":step week :block 2017-10 :stepskip0 t")))))
|
|
|
+;; ;; :step day
|
|
|
+;; (should
|
|
|
+;; (equal "
|
|
|
+;; Daily report: [2017-10-02 Mon]
|
|
|
+;; | Headline | Time |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | *Total time* | *3:00* |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | Foo | 3:00 |
|
|
|
+
|
|
|
+;; Daily report: [2017-10-03 Tue]
|
|
|
+;; | Headline | Time |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | *Total time* | *0:00* |
|
|
|
+
|
|
|
+;; Daily report: [2017-10-04 Wed]
|
|
|
+;; | Headline | Time |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | *Total time* | *0:00* |
|
|
|
+
|
|
|
+;; Daily report: [2017-10-05 Thu]
|
|
|
+;; | Headline | Time |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | *Total time* | *0:00* |
|
|
|
+
|
|
|
+;; Daily report: [2017-10-06 Fri]
|
|
|
+;; | Headline | Time |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | *Total time* | *0:00* |
|
|
|
+
|
|
|
+;; Daily report: [2017-10-07 Sat]
|
|
|
+;; | Headline | Time |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | *Total time* | *0:00* |
|
|
|
+
|
|
|
+;; Daily report: [2017-10-08 Sun]
|
|
|
+;; | Headline | Time |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | *Total time* | *4:00* |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | Foo | 4: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 11:00]--[2017-10-01 Sun 13:00] => 2:00
|
|
|
+;; CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 14:00] => 3:00
|
|
|
+;; CLOCK: [2017-10-08 Sun 09:00]--[2017-10-08 Sun 13:00] => 4:00
|
|
|
+;; CLOCK: [2017-10-09 Mon 09:00]--[2017-10-09 Mon 14:00] => 5:00"
|
|
|
+;; (let ((system-time-locale "en_US"))
|
|
|
+;; (test-org-clock-clocktable-contents
|
|
|
+;; ":step day :block 2017-W40")))))
|
|
|
+;; ;; Regression test: take :tstart and :tend hours into consideration.
|
|
|
+;; (should
|
|
|
+;; (equal "
|
|
|
+;; Weekly report starting on: [2017-12-25 Mon]
|
|
|
+;; | Headline | Time |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | *Total time* | *8:00* |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | Foo | 8:00 |"
|
|
|
+;; (org-test-with-temp-text
|
|
|
+;; "* Foo
|
|
|
+;; CLOCK: [2017-12-27 Wed 08:00]--[2017-12-27 Wed 16:00] => 8:00"
|
|
|
+;; (let ((system-time-locale "en_US"))
|
|
|
+;; (test-org-clock-clocktable-contents
|
|
|
+;; (concat ":step week :tstart \"<2017-12-25 Mon>\" "
|
|
|
+;; ":tend \"<2017-12-27 Wed 23:59>\""))))))
|
|
|
+;; (should
|
|
|
+;; (equal "
|
|
|
+;; Daily report: [2017-12-27 Wed]
|
|
|
+;; | Headline | Time |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | *Total time* | *8:00* |
|
|
|
+;; |--------------+--------|
|
|
|
+;; | Foo | 8:00 |"
|
|
|
+;; (org-test-with-temp-text
|
|
|
+;; "* Foo
|
|
|
+;; CLOCK: [2017-12-27 Wed 08:00]--[2017-12-27 Wed 16:00] => 8:00"
|
|
|
+;; (let ((system-time-locale "en_US"))
|
|
|
+;; (test-org-clock-clocktable-contents
|
|
|
+;; (concat ":step day :tstart \"<2017-12-25 Mon>\" "
|
|
|
+;; ":tend \"<2017-12-27 Wed 23:59>\" :stepskip0 t")))))))
|
|
|
|
|
|
(provide 'test-org-clock)
|
|
|
;;; test-org-clock.el end here
|