浏览代码

tests protecting nested code blocks

* testing/lisp/test-ob.el (test-org-babel/nested-code-block):
  Evaluation of a nested block.
  (test-org-babel/partial-nested-code-block): Evaluation of a
  partially nested block.
Eric Schulte 13 年之前
父节点
当前提交
f98ee77b38
共有 1 个文件被更改,包括 17 次插入0 次删除
  1. 17 0
      testing/lisp/test-ob.el

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

@@ -403,6 +403,23 @@ duplicate results block."
     (should (search-forward "Hello")) ; the same string in the results block
     (should-error (search-forward "Hello"))))
 
+(ert-deftest test-org-babel/nested-code-block ()
+  "Test nested code blocks inside code blocks don't cause problems."
+  (org-test-with-temp-text "#+begin_src org :results silent
+  ,#+begin_src emacs-lisp
+  ,  'foo
+  ,#+end_src
+#+end_src"
+    (should (string= (org-babel-execute-src-block)
+		     "#+begin_src emacs-lisp\n  'foo\n#+end_src"))))
+
+(ert-deftest test-org-babel/partial-nested-code-block ()
+  "Test nested code blocks inside code blocks don't cause problems."
+  (org-test-with-temp-text "#+begin_src org :results silent
+  ,#+begin_src emacs-lisp
+#+end_src"
+    (should (string= "#+begin_src emacs-lisp" (org-babel-execute-src-block)))))
+
 (provide 'test-ob)
 
 ;;; test-ob ends here