test-property-inheritance.el 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. ;;; Code:
  7. (defmacro test-org-in-property-buffer (&rest body)
  8. `(with-temp-buffer
  9. (insert-file-contents (expand-file-name "property-inheritance.org"
  10. org-test-example-dir))
  11. (org-mode)
  12. ,@body))
  13. (def-edebug-spec test-org-in-property-buffer (body))
  14. (ert-deftest test-org-property-accumulation-top-use ()
  15. (test-org-in-property-buffer
  16. (goto-char (point-min))
  17. (org-babel-next-src-block 1)
  18. (should (equal 3 (org-babel-execute-src-block)))))
  19. (ert-deftest test-org-property-accumulation-top-val ()
  20. (test-org-in-property-buffer
  21. (goto-char (point-min))
  22. (org-babel-next-src-block 2)
  23. (should (string= "foo=1 bar=2" (org-babel-execute-src-block)))))
  24. (ert-deftest test-org-property-accumulation-overwrite-use ()
  25. (test-org-in-property-buffer
  26. (goto-char (point-min))
  27. (org-babel-next-src-block 3)
  28. (should (= 7 (org-babel-execute-src-block)))))
  29. (ert-deftest test-org-property-accumulation-overwrite-val ()
  30. (test-org-in-property-buffer
  31. (goto-char (point-min))
  32. (org-babel-next-src-block 4)
  33. (should (string= "foo=7" (org-babel-execute-src-block)))))
  34. (ert-deftest test-org-property-accumulation-append-use ()
  35. (test-org-in-property-buffer
  36. (goto-char (point-min))
  37. (org-babel-next-src-block 5)
  38. (should (= 6 (org-babel-execute-src-block)))))
  39. (ert-deftest test-org-property-accumulation-append-val ()
  40. (test-org-in-property-buffer
  41. (goto-char (point-min))
  42. (org-babel-next-src-block 6)
  43. (should (string= "foo=1 bar=2 baz=3" (org-babel-execute-src-block)))))
  44. (provide 'test-ob-R)
  45. ;;; test-ob-R.el ends here