Browse Source

org-clock: Re-activate tests

* testing/lisp/test-org-clock.el (test-org-clock/clocktable/ranges):
(test-org-clock/clocktable/step): Un-comment tests.

They were commented out in "org-clock.el: New option :tags to insert
tags in clock reports".
Nicolas Goaziou 2 years ago
parent
commit
ba5bedc17f
1 changed files with 183 additions and 183 deletions
  1. 183 183
      testing/lisp/test-org-clock.el

+ 183 - 183
testing/lisp/test-org-clock.el

@@ -273,54 +273,54 @@ the buffer."
 
 ;;; Clocktable
 
-;; (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/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."
@@ -843,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