ob: Fix and add tests for mkdirp header argument

* testing/lisp/test-ob.el (test-ob-core/dir-mkdirp): Add tests.
This commit is contained in:
Nicolas Goaziou 2019-03-04 22:34:31 +01:00
parent 8b5941330b
commit 0c1916657a
1 changed files with 25 additions and 5 deletions

View File

@ -1608,12 +1608,32 @@ echo \"$data\"
))
(ert-deftest test-ob-core/dir-mkdirp ()
(org-test-with-temp-text
"#+begin_src sh :mkdirp yes :dir \"data/code\"
pwd
"Test :mkdirp with :dir header combination."
(should-not
(org-test-with-temp-text-in-file
"#+begin_src emacs-lisp :dir \"data/code\"
t
#+end_src"
(org-babel-execute-src-block))
(should (file-directory-p "data/code")))
(org-babel-execute-src-block)
(message default-directory)
(file-directory-p "data/code")))
(should-not
(org-test-with-temp-text-in-file
"#+begin_src emacs-lisp :mkdirp no :dir \"data/code\"
t
#+end_src"
(org-babel-execute-src-block)
(message default-directory)
(file-directory-p "data/code")))
(should
(org-test-with-temp-text-in-file
"#+begin_src emacs-lisp :mkdirp yes :dir \"data/code\"
t
#+end_src"
(org-babel-execute-src-block)
(message default-directory)
(prog1 (file-directory-p "data/code")
(delete-directory "data" t)))))
(ert-deftest test-ob/script-escape ()
;; Delimited lists of numbers