|
@@ -323,6 +323,39 @@ Here is one at the end of a line. =2=
|
|
|
(org-export-execute-babel-code)
|
|
|
(buffer-string)))))
|
|
|
|
|
|
+(ert-deftest ob-export/export-and-indentation ()
|
|
|
+ "Test indentation of evaluated source blocks during export."
|
|
|
+ ;; No indentation.
|
|
|
+ (should
|
|
|
+ (string-match
|
|
|
+ "^t"
|
|
|
+ (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n t\n#+END_SRC"
|
|
|
+ (let ((indent-tabs-mode t)
|
|
|
+ (tab-width 1)
|
|
|
+ (org-src-preserve-indentation nil))
|
|
|
+ (org-export-execute-babel-code)
|
|
|
+ (buffer-string)))))
|
|
|
+ ;; Preserve indentation with "-i" flag.
|
|
|
+ (should
|
|
|
+ (string-match
|
|
|
+ "^ t"
|
|
|
+ (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp -i\n t\n#+END_SRC"
|
|
|
+ (let ((indent-tabs-mode t)
|
|
|
+ (tab-width 1))
|
|
|
+ (org-export-execute-babel-code)
|
|
|
+ (buffer-string)))))
|
|
|
+ ;; Preserve indentation with a non-nil
|
|
|
+ ;; `org-src-preserve-indentation'.
|
|
|
+ (should
|
|
|
+ (string-match
|
|
|
+ "^ t"
|
|
|
+ (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n t\n#+END_SRC"
|
|
|
+ (let ((indent-tabs-mode t)
|
|
|
+ (tab-width 1)
|
|
|
+ (org-src-preserve-indentation t))
|
|
|
+ (org-export-execute-babel-code)
|
|
|
+ (buffer-string))))))
|
|
|
+
|
|
|
(provide 'test-ob-exp)
|
|
|
|
|
|
;;; test-ob-exp.el ends here
|