test-ob.el 1.0 KB

1234567891011121314151617181920212223242526272829
  1. ;;; test-ob.el --- tests for ob.el
  2. (require 'org-test)
  3. (defmacro test-ob-in-code-block (marker &rest body)
  4. (declare (indent 1))
  5. `(in-org-example-file
  6. (goto-char (point-min))
  7. (re-search-forward (regexp-quote ,marker))
  8. ,@body))
  9. (ert-deftest test-org-babel-get-src-block-info-language ()
  10. (test-ob-in-code-block "94839181-184f-4ff4-a72f-94214df6f5ba"
  11. (let ((info (org-babel-get-src-block-info)))
  12. (should (string= "emacs-lisp" (nth 0 info))))))
  13. (ert-deftest test-org-babel-get-src-block-info-body ()
  14. (test-ob-in-code-block "94839181-184f-4ff4-a72f-94214df6f5ba"
  15. (let ((info (org-babel-get-src-block-info)))
  16. (should (string-match (regexp-quote "94839181-184f-4ff4-a72f-94214df6f5ba")
  17. (nth 1 info))))))
  18. (ert-deftest test-org-babel-get-src-block-info-tangle ()
  19. (test-ob-in-code-block "94839181-184f-4ff4-a72f-94214df6f5ba"
  20. (let ((info (org-babel-get-src-block-info)))
  21. (should (string= "no" (cdr (assoc :tangle (nth 2 info))))))))
  22. (provide 'test-ob)
  23. ;;; test-ob ends here