test-property-inheritance.el 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ;;; test-ob-R.el --- tests for ob-R.el
  2. ;; Copyright (c) 2011 Eric Schulte
  3. ;; Authors: Eric Schulte
  4. ;; Released under the GNU General Public License version 3
  5. ;; see: http://www.gnu.org/licenses/gpl-3.0.html
  6. (let ((load-path (cons (expand-file-name
  7. ".." (file-name-directory
  8. (or load-file-name buffer-file-name)))
  9. load-path)))
  10. (require 'org-test)
  11. (require 'org-test-ob-consts))
  12. (defmacro test-org-in-property-buffer (&rest body)
  13. `(with-temp-buffer
  14. (insert-file-contents (expand-file-name "property-inheritance.org"
  15. org-test-example-dir))
  16. (org-mode)
  17. ,@body))
  18. (ert-deftest test-org-property-accumulation-top-use ()
  19. (test-org-in-property-buffer
  20. (goto-char (point-min))
  21. (org-babel-next-src-block 1)
  22. (should (equal 3 (org-babel-execute-src-block)))))
  23. (ert-deftest test-org-property-accumulation-top-val ()
  24. (test-org-in-property-buffer
  25. (goto-char (point-min))
  26. (org-babel-next-src-block 2)
  27. (should (string= "foo=1 bar=2" (org-babel-execute-src-block)))))
  28. (ert-deftest test-org-property-accumulation-overwrite-use ()
  29. (test-org-in-property-buffer
  30. (goto-char (point-min))
  31. (org-babel-next-src-block 3)
  32. (should (= 7 (org-babel-execute-src-block)))))
  33. (ert-deftest test-org-property-accumulation-overwrite-val ()
  34. (test-org-in-property-buffer
  35. (goto-char (point-min))
  36. (org-babel-next-src-block 4)
  37. (should (string= "foo=7" (org-babel-execute-src-block)))))
  38. (ert-deftest test-org-property-accumulation-append-use ()
  39. (test-org-in-property-buffer
  40. (goto-char (point-min))
  41. (org-babel-next-src-block 5)
  42. (should (= 6 (org-babel-execute-src-block)))))
  43. (ert-deftest test-org-property-accumulation-append-val ()
  44. (test-org-in-property-buffer
  45. (goto-char (point-min))
  46. (org-babel-next-src-block 6)
  47. (should (string= "foo=1 bar=2 baz=3" (org-babel-execute-src-block)))))
  48. (provide 'test-ob-R)
  49. ;;; test-ob-R.el ends here