emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [test] org-colview/org-columns
@ 2023-04-17 17:42 Sławomir Grochowski
  2023-04-18 11:23 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Sławomir Grochowski @ 2023-04-17 17:42 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 275 bytes --]

Dear All,

I'm trying to better understand 'org-colview/org-columns'.
So I wrote some tests. File in attachment.
I hope the commit message is correct.

I will be very grateful for your comments & feedback on what can be done
better.

Regards,
Sławomir Grochowski

[-- Attachment #1.2: Type: text/html, Size: 435 bytes --]

[-- Attachment #2: 0001-testing-lisp-test-org-colview.el-Add-tests.patch --]
[-- Type: text/x-patch, Size: 3103 bytes --]

From 2768ecfd896d2dd950b23f0134a3779523479d35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= <slawomir.grochowski@gmail.com>
Date: Mon, 17 Apr 2023 19:18:16 +0200
Subject: [PATCH] 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 9daec18e2..a80763622 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'.
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [test] org-colview/org-columns
  2023-04-17 17:42 [test] org-colview/org-columns Sławomir Grochowski
@ 2023-04-18 11:23 ` Ihor Radchenko
  2023-05-14 14:11   ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2023-04-18 11:23 UTC (permalink / raw)
  To: Sławomir Grochowski; +Cc: emacs-orgmode

Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:

> I'm trying to better understand 'org-colview/org-columns'.
> So I wrote some tests. File in attachment.

Thanks! The tests look good to me.

> I hope the commit message is correct.
> ...
> * 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

Almost. You forgot `...' quotes around Elisp symbols and "." at the end
of sentence.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [test] org-colview/org-columns
  2023-04-18 11:23 ` Ihor Radchenko
@ 2023-05-14 14:11   ` Ihor Radchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2023-05-14 14:11 UTC (permalink / raw)
  To: Sławomir Grochowski; +Cc: emacs-orgmode


Ihor Radchenko <yantar92@posteo.net> writes:
> Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:
>
>> I'm trying to better understand 'org-colview/org-columns'.
>> So I wrote some tests. File in attachment.
>
> Thanks! The tests look good to me.

Applied, onto main. (A different, sent privately, version.)
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=03afd2558

You are now listed as Org contributor
https://git.sr.ht/~bzg/worg/commit/1e54a8ad

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-14 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-17 17:42 [test] org-colview/org-columns Sławomir Grochowski
2023-04-18 11:23 ` Ihor Radchenko
2023-05-14 14:11   ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).