test-property-inheritance.el 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ;;; test-property-inheritance.el --- tests for property-inheritance.el -*- lexical-binding: t; -*-
  2. ;; Copyright (c) 2011-2014, 2019 Eric Schulte
  3. ;; Authors: Eric Schulte
  4. ;; This file is not part of GNU Emacs.
  5. ;; This program is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; This program is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. ;;; Code:
  16. (defmacro test-org-in-property-buffer (&rest body)
  17. `(with-temp-buffer
  18. (insert-file-contents (expand-file-name "property-inheritance.org"
  19. org-test-example-dir))
  20. (org-mode)
  21. ,@body))
  22. (def-edebug-spec test-org-in-property-buffer (body))
  23. (ert-deftest test-org-property-accumulation-top-use ()
  24. (test-org-in-property-buffer
  25. (goto-char (point-min))
  26. (org-babel-next-src-block 1)
  27. (should (equal 3 (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 2)
  32. (should (= 7 (org-babel-execute-src-block)))))
  33. (ert-deftest test-org-property-accumulation-append-use ()
  34. (test-org-in-property-buffer
  35. (goto-char (point-min))
  36. (org-babel-next-src-block 3)
  37. (should (= 6 (org-babel-execute-src-block)))))
  38. (provide 'test-property-inheritance)
  39. ;;; test-property-inheritance.el ends here