emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: "Sebastian Reuße" <seb@wirrsal.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH 1/2] Add tests for org-refile-get-targets
Date: Mon, 15 May 2017 18:38:09 +0200	[thread overview]
Message-ID: <87efvqxeha.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <20170515125455.18251-1-seb@wirrsal.net> ("Sebastian Reuße"'s message of "Mon, 15 May 2017 14:54:54 +0200")

Hello,

Sebastian Reuße <seb@wirrsal.net> writes:

> * testing/lisp/test-org.el: Add test.
> ---

Thank you.

>  testing/examples/refile/a.org |  6 ++++++
> +\f
> +;;; org-refile

Nitpick: Sections in test-org.el are sorted alphabetically. So the new
"Refile" section could go between "Radio Targets" and "Sparse trees".

> +(ert-deftest test-org/org-refile-get-targets ()
> +  "Test `org-refile-get-targets'."
> +  (save-window-excursion
> +    (let ((examples-dir (file-truename "../examples/refile/")))
> +      (cd examples-dir)
> +      (find-file-read-only "a.org")
> +      (find-file-read-only "b.org")
> +      (rename-buffer "gratuitous-prefix/b.org")
> +      (let ((org-refile-targets '((("a.org" "b.org") :level . 2)))
> +	    (testcases
> +	     `((nil . ("a/1/2"
> +		       "a/2/2"
> +		       "b/1/2"
> +		       "b/2/2"))
> +	       (file . ("a.org"
> +			"a.org/a\\/1\\/1/a\\/1\\/2"
> +			"a.org/a\\/2\\/1/a\\/2\\/2"
> +			"b.org"
> +			"b.org/b\\/1\\/1/b\\/1\\/2"
> +			"b.org/b\\/2\\/1/b\\/2\\/2"))
> +	       (full-file-path . ,(mapcar (lambda (s) (concat examples-dir s))
> +					  '("a.org"
> +					    "a.org/a\\/1\\/1/a\\/1\\/2"
> +					    "a.org/a\\/2\\/1/a\\/2\\/2"
> +					    "b.org"
> +					    "b.org/b\\/1\\/1/b\\/1\\/2"
> +					    "b.org/b\\/2\\/1/b\\/2\\/2")))
> +	       (buffer-name . ("a.org"
> +			       "a.org/a\\/1\\/1/a\\/1\\/2"
> +			       "a.org/a\\/2\\/1/a\\/2\\/2"
> +			       "gratuitous-prefix/b.org"
> +			       "gratuitous-prefix/b.org/b\\/1\\/1/b\\/1\\/2"
> +			       "gratuitous-prefix/b.org/b\\/2\\/1/b\\/2\\/2")))))
> +	(cl-loop for (use-outline-path . expected-targets) in testcases
> +		 do (let ((org-refile-use-outline-path use-outline-path))
> +		      (should
> +		       (equal
> +			(mapcar #'car
> +				(org-refile-get-targets))
> +			expected-targets))))))))
> +

Would it be possible to split this big test into smaller ones, with
a description about what is really tested? See other tests in
"test-org.el" for some examples. Big tests tend to not being very
informative when they fail. IMO, code duplication is not an issue in
test files when it makes tests more readable/useful.

It would be even better if you can avoid relying on real files ("a.org"
and "b.org" in your patch), but if it makes the test too convoluted, no
worries.

Regards,

-- 
Nicolas Goaziou

  parent reply	other threads:[~2017-05-15 16:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15 12:54 [PATCH 1/2] Add tests for org-refile-get-targets Sebastian Reuße
2017-05-15 12:54 ` [PATCH 2/2] org-refile: Fix inconsistency when listing refile targets Sebastian Reuße
2017-05-17 12:54   ` Nicolas Goaziou
2017-06-21  7:05   ` Allen Li
2017-06-21  7:55     ` Sebastian Reuße
2017-06-21  8:01       ` Allen Li
2017-06-28 22:03         ` Allen Li
2017-07-03  6:44           ` Nicolas Goaziou
2017-07-07  6:55             ` Allen Li
2017-05-15 16:38 ` Nicolas Goaziou [this message]
2017-05-17 18:43   ` [PATCH 1/2] Add tests for org-refile-get-targets Sebastian Reuße
2017-05-22  0:38     ` Nicolas Goaziou
2017-05-22  6:46       ` Sebastian Reuße
2017-05-22  6:55         ` Nicolas Goaziou
2017-05-17 18:44   ` [PATCH] " Sebastian Reuße

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87efvqxeha.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=seb@wirrsal.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).