emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daniel Hackney <dan@haxney.org>
To: emacs-orgmode@gnu.org
Subject: [proposal] org-test: Embedded self-tests in orgmode files
Date: Sat, 27 Jul 2013 14:32:04 -0400	[thread overview]
Message-ID: <CAMqXDZs4B6qbq0c98yh5ZAOd4jfTHefHZAAGuBXhQ7h3y7AQ1w@mail.gmail.com> (raw)

After finding that =fill-paragraph= has regressed again, I threw
together a quick hack to allow for creating unit tests in orgmode. The
result is at [1].

This simply lets you create an org file like so:

#+BEGIN_SRC org
  ,* Test heading
    ,#+BEGIN_SRC emacs-lisp
      (org-test-def org-test-fill-paragraph
        "Test filling paragraphs"
        (fill-paragraph))
    ,#+END_SRC

  ,** Before                                                  :before:
     ⁁Lorem
     Ipsum
  ,** Expected                                              :expected:
     ⁁Lorem Ipsum
#+END_SRC

put the point in the source block, hit =C-c C-c= and have it return

#+BEGIN_SRC org
  ,#+RESULTS:
  : t
#+END_SRC

The =⁁= character is =u+2041=, aka =CARET INSERTION POINT=, and notes
where point should be before and after running the code.

My idea is that this code could be refined to generate ERT tests
allowing orgmode to have a unit test suite.

What does everyone think?

P.S. I'm not on the list, so please include me in replies.

[1] https://github.com/haxney/org-test

--
Daniel Hackney

             reply	other threads:[~2013-07-27 18:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-27 18:32 Daniel Hackney [this message]
2013-07-27 18:42 ` [proposal] org-test: Embedded self-tests in orgmode files Nicolas Goaziou
2013-07-27 18:48   ` Daniel Hackney

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=CAMqXDZs4B6qbq0c98yh5ZAOd4jfTHefHZAAGuBXhQ7h3y7AQ1w@mail.gmail.com \
    --to=dan@haxney.org \
    --cc=emacs-orgmode@gnu.org \
    /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).