emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 03afd25582 1/2: testing/lisp/test-org-colview.el: A


From: ELPA Syncer
Subject: [elpa] externals/org 03afd25582 1/2: testing/lisp/test-org-colview.el: Add tests
Date: Sun, 14 May 2023 10:59:02 -0400 (EDT)

branch: externals/org
commit 03afd25582544ca904c7796b0f656b5b8c6f53d9
Author: Sławomir Grochowski <slawomir.grochowski@gmail.com>
Commit: Ihor Radchenko <yantar92@posteo.net>

    testing/lisp/test-org-colview.el: Add tests
    
    * test-org-colview.el (test-org-colview/uncompile-format,
    test-org-colview/compile-format): Add tests for functions:
    `org-columns-uncompile-format' & `org-columns-compile-format'.
---
 testing/lisp/test-org-colview.el | 66 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el
index 9daec18e24..a80763622c 100644
--- a/testing/lisp/test-org-colview.el
+++ b/testing/lisp/test-org-colview.el
@@ -26,6 +26,72 @@
 (require 'org-duration)
 (require 'org-inlinetask)
 
+(ert-deftest test-org-colview/uncompile-format ()
+  "Test `org-columns-uncompile-format' specifications."
+  ;; With minimum data, one element
+  (should
+   (equal "%ITEM"
+          (org-columns-uncompile-format '(("ITEM" "ITEM" nil nil nil)))))
+  ;; With minimum data, two element
+  (should
+   (equal "%ITEM %TODO"
+          (org-columns-uncompile-format
+           `(("ITEM" "ITEM" nil nil nil) ("TODO" "TODO" nil nil nil)))))
+  ;; Read width
+  (should
+   (equal "%10ITEM"
+          (org-columns-uncompile-format `(("ITEM" "ITEM" 10 nil nil)))))
+  ;; Read title
+  (should
+   (equal "%ITEM(some title)"
+          (org-columns-uncompile-format `(("ITEM" "some title" nil nil nil)))))
+  ;; Read operator
+  (should
+   (equal "%ITEM{+}"
+          (org-columns-uncompile-format `(("ITEM" "ITEM" nil "+" nil)))))
+  ;; Read operator printf
+  (should
+   (equal "%ITEM{+;%.1f}"
+          (org-columns-uncompile-format  `(("ITEM" "ITEM" nil "+" "%.1f"))))))
+
+(ert-deftest test-org-colview/compile-format ()
+  "Test `org-columns-compile-format' specifications."
+  ;; With minimum data, one element
+  (should
+   (equal `(("ITEM" "ITEM" nil nil nil))
+          (org-columns-compile-format
+           "%ITEM")))
+  ;; With minimum data, two element
+  (should
+   (equal `(("ITEM" "ITEM" nil nil nil) ("TODO" "TODO" nil nil nil))
+          (org-columns-compile-format
+           "%ITEM %TODO")))
+  ;; Read width
+  (should
+   (equal `(("ITEM" "ITEM" 10 nil nil))
+          (org-columns-compile-format
+           "%10ITEM")))
+  ;; Upcase property name
+  (should
+   (equal `(("ITEM" "item" nil nil nil))
+          (org-columns-compile-format
+           "%item")))
+  ;; Read title
+  (should
+   (equal `(("ITEM" "some title" nil nil nil))
+          (org-columns-compile-format
+           "%ITEM(some title)")))
+  ;; Read operator
+  (should
+   (equal `(("ITEM" "ITEM" nil "+" nil))
+          (org-columns-compile-format
+           "%ITEM{+}")))
+  ;; Read operator printf
+  (should
+   (equal `(("ITEM" "ITEM" nil "+" "%.1f"))
+          (org-columns-compile-format
+           "%ITEM{+;%.1f}"))))
+
 (ert-deftest test-org-colview/get-format ()
   "Test `org-columns-get-format' specifications."
   ;; Without any clue, use `org-columns-default-format'.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]