Parcourir la source

testing that results are duplicated -- By Sebastien Vauban

* testing/lisp/test-ob.el (test-org-babel/just-one-results-block):
  Ensure that result blocks are not duplicated.
Eric Schulte il y a 14 ans
Parent
commit
b3e322125d
1 fichiers modifiés avec 10 ajouts et 0 suppressions
  1. 10 0
      testing/lisp/test-ob.el

+ 10 - 0
testing/lisp/test-ob.el

@@ -435,6 +435,16 @@
 	  "variable \"x\" in block \"carre\" must be assigned a default value")
 	err)))))
 
+(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
+    (should (search-forward "Hello")) ; the string inside the source code block
+    (should (search-forward "Hello")) ; the same string in the results block
+    (should-error (search-forward "Hello"))))
+
 (provide 'test-ob)
 
 ;;; test-ob ends here