2010-10-03 12:45:07 -04:00
|
|
|
|
;;; test-ob.el --- tests for ob.el
|
|
|
|
|
|
2010-10-04 10:06:16 -04:00
|
|
|
|
;; Copyright (c) 2010 Eric Schulte
|
|
|
|
|
;; Authors: Eric Schulte
|
|
|
|
|
|
|
|
|
|
;; Released under the GNU General Public License version 3
|
|
|
|
|
;; see: http://www.gnu.org/licenses/gpl-3.0.html
|
|
|
|
|
|
|
|
|
|
;;;; Comments:
|
|
|
|
|
|
|
|
|
|
;; Template test file for Org-mode tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
2010-10-06 11:02:25 -04:00
|
|
|
|
(let ((load-path (cons (expand-file-name
|
|
|
|
|
".." (file-name-directory
|
|
|
|
|
(or load-file-name buffer-file-name)))
|
|
|
|
|
load-path)))
|
|
|
|
|
(require 'org-test)
|
|
|
|
|
(require 'org-test-ob-consts))
|
2010-10-03 12:45:07 -04:00
|
|
|
|
|
2010-10-14 09:32:21 -04:00
|
|
|
|
;;; ob-get-src-block-info
|
2010-10-03 12:45:07 -04:00
|
|
|
|
(ert-deftest test-org-babel-get-src-block-info-language ()
|
2010-10-04 22:07:51 -04:00
|
|
|
|
(org-test-at-marker nil org-test-file-ob-anchor
|
2010-10-03 12:45:07 -04:00
|
|
|
|
(let ((info (org-babel-get-src-block-info)))
|
|
|
|
|
(should (string= "emacs-lisp" (nth 0 info))))))
|
|
|
|
|
|
|
|
|
|
(ert-deftest test-org-babel-get-src-block-info-body ()
|
2010-10-04 22:07:51 -04:00
|
|
|
|
(org-test-at-marker nil org-test-file-ob-anchor
|
2010-10-03 12:45:07 -04:00
|
|
|
|
(let ((info (org-babel-get-src-block-info)))
|
2010-10-04 22:07:51 -04:00
|
|
|
|
(should (string-match (regexp-quote org-test-file-ob-anchor)
|
2010-10-03 12:45:07 -04:00
|
|
|
|
(nth 1 info))))))
|
|
|
|
|
|
|
|
|
|
(ert-deftest test-org-babel-get-src-block-info-tangle ()
|
2010-10-04 22:07:51 -04:00
|
|
|
|
(org-test-at-marker nil org-test-file-ob-anchor
|
2010-10-03 12:45:07 -04:00
|
|
|
|
(let ((info (org-babel-get-src-block-info)))
|
|
|
|
|
(should (string= "no" (cdr (assoc :tangle (nth 2 info))))))))
|
|
|
|
|
|
2010-10-14 09:32:21 -04:00
|
|
|
|
(ert-deftest test-org-babel-elisp-in-header-arguments ()
|
2010-10-15 14:38:48 -04:00
|
|
|
|
"Test execution of elisp forms in header arguments."
|
2010-10-14 09:32:21 -04:00
|
|
|
|
;; at the babel.org:elisp-forms-in-header-arguments header
|
|
|
|
|
(org-test-at-id "22d67284-bf14-4cdc-8319-f4bd876829d7"
|
|
|
|
|
(org-babel-next-src-block)
|
|
|
|
|
(let ((info (org-babel-get-src-block-info)))
|
|
|
|
|
(should (= 4 (org-babel-execute-src-block))))))
|
2010-10-04 10:06:16 -04:00
|
|
|
|
|
2010-10-15 14:38:48 -04:00
|
|
|
|
(ert-deftest test-org-babel-simple-variable-resolution ()
|
|
|
|
|
"Test that simple variable resolution is working."
|
|
|
|
|
(org-test-at-id "f68821bc-7f49-4389-85b5-914791ee3718"
|
|
|
|
|
(org-babel-next-src-block 2)
|
|
|
|
|
(should (= 4 (org-babel-execute-src-block)))))
|
|
|
|
|
|
2010-10-03 12:45:07 -04:00
|
|
|
|
(provide 'test-ob)
|
|
|
|
|
|
|
|
|
|
;;; test-ob ends here
|