test-property-inheritance.el 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. ;;; test-ob-R.el --- tests for ob-R.el
  2. ;; Copyright (c) 2011-2012 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. (def-edebug-spec test-org-in-property-buffer (body))
  19. (ert-deftest test-org-property-accumulation-top-use ()
  20. (test-org-in-property-buffer
  21. (goto-char (point-min))
  22. (org-babel-next-src-block 1)
  23. (should (equal 3 (org-babel-execute-src-block)))))
  24. (ert-deftest test-org-property-accumulation-top-val ()
  25. (test-org-in-property-buffer
  26. (goto-char (point-min))
  27. (org-babel-next-src-block 2)
  28. (should (string= "foo=1 bar=2" (org-babel-execute-src-block)))))
  29. (ert-deftest test-org-property-accumulation-overwrite-use ()
  30. (test-org-in-property-buffer
  31. (goto-char (point-min))
  32. (org-babel-next-src-block 3)
  33. (should (= 7 (org-babel-execute-src-block)))))
  34. (ert-deftest test-org-property-accumulation-overwrite-val ()
  35. (test-org-in-property-buffer
  36. (goto-char (point-min))
  37. (org-babel-next-src-block 4)
  38. (should (string= "foo=7" (org-babel-execute-src-block)))))
  39. (ert-deftest test-org-property-accumulation-append-use ()
  40. (test-org-in-property-buffer
  41. (goto-char (point-min))
  42. (org-babel-next-src-block 5)
  43. (should (= 6 (org-babel-execute-src-block)))))
  44. (ert-deftest test-org-property-accumulation-append-val ()
  45. (test-org-in-property-buffer
  46. (goto-char (point-min))
  47. (org-babel-next-src-block 6)
  48. (should (string= "foo=1 bar=2 baz=3" (org-babel-execute-src-block)))))
  49. (provide 'test-ob-R)
  50. ;;; test-ob-R.el ends here