emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [proposal] org-test: Embedded self-tests in orgmode files


From: Daniel Hackney
Subject: [O] [proposal] org-test: Embedded self-tests in orgmode files
Date: Sat, 27 Jul 2013 14:32:04 -0400

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 via email to

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