#+TITLE: Multiple results blocks for the same source code
#+AUTHOR: Seb Vauban
#+DATE: 2011-09-23
#+LANGUAGE: en
* Bug
When evaluating multiple times the following code, we get multiple =results=
blocks.
#+begin_src sh
echo Hello
#+end_src
#+results:
: Hello
#+results:
: Hello
* ERT Test Case
#+begin_src emacs-lisp
(ert-deftest test-org-babel/just-one-results-block ()
"Test that evaluating two times the same code block does not result in a
duplicate results block."
(org-test-with-temp-text "#+begin_src sh\necho Hello\n#+end_src\n"
(org-babel-execute-src-block)
(org-babel-execute-src-block) ;; second code block execution
;; where is point (supposed to be)?
(goto-char (point-min))
(should (search-forward "Hello")) ;; the string inside the source code block
(should (search-forward "Hello")) ;; the same string in the (first?)
results block
(should-error (search-forward "Hello"))))
#+end_src
* Extra context
This problem appeared after having executed sh code blocks (calling Ledger)
which failed -- for some reason still to be studied.
After an Emacs restart, I can't reproduce this anymore. So, not really fixed,
but not there systematically either...
Status is unreproducible right now, but I guess the above test case can
already be added. Please comment on it, for me to progress...
Best regards,
Seb
--
Sebastien Vauban