From: Ihor Radchenko <yantar92@posteo.net>
To: Phil Estival <pe@7d.nz>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: To factorize code of test sets (or not)
Date: Thu, 09 Jan 2025 17:17:28 +0000 [thread overview]
Message-ID: <87jzb36h5j.fsf@localhost> (raw)
In-Reply-To: <18d80a44-bc2b-472a-bf62-05878b4f8fa4@7d.nz>
Phil Estival <pe@7d.nz> writes:
> This may appear as an unnecessary effort to refactor, or worse,
> normalize a code that can benefit from some diversity
> yet,
> the forms
>
> (should
> (equal "<str result>"
> (org-test-with-temp-text "<block>"
> (org-babel-next-src-block)
> (org-trim (org-babel-execute-src-block))))))
> ...
> exist in
> test-ob-[maxima,R,sqlite,sed,shell,plantuml,lua,java,julia,lob,octave,perl,python,emacs-lisp].el
>
> Considering it at the repetitive pattern, I think a macro can shorten
> those forms to :
>
> (ob-test "<preamble + block>"
> :expect "<expected-result>")
> ...
> (ob-test "<preamble+block>"
> :expect-to-match "<expected regexp to match>")
Looks reasonable.
Although, :expect/:expect-*-to-* are probably redundant.
We may instead use some kind of anamorphic form like:
(ob-with-src-block-result "...."
(should (equal it "expected"))
(should (string-match-p "expected-re" it))
(should-not ...)
...)
--
Ihor Radchenko // yantar92,
Org mode maintainer,
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>
prev parent reply other threads:[~2025-01-09 17:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 8:45 To factorize code of test sets (or not) Phil Estival
2025-01-09 17:17 ` Ihor Radchenko [this message]
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=87jzb36h5j.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=pe@7d.nz \
/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).