test-org-table.el 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ;;; test-org-table.el
  2. ;; Copyright (c) ߛ David Maus
  3. ;; Authors: David Maus
  4. ;; Released under the GNU General Public License version 3
  5. ;; see: http://www.gnu.org/licenses/gpl-3.0.html
  6. ;;;; Comments:
  7. ;; Template test file for Org-mode tests
  8. ;;; Code:
  9. (let ((load-path (cons (expand-file-name
  10. ".." (file-name-directory
  11. (or load-file-name buffer-file-name)))
  12. load-path)))
  13. (require 'org-test)
  14. (require 'org-test-ob-consts))
  15. ;;; Tests
  16. (ert-deftest test-org-table/org-table-convert-refs-to-an/1 ()
  17. "Simple reference @1$1."
  18. (should
  19. (string= "A1" (org-table-convert-refs-to-an "@1$1"))))
  20. ;; TODO: Test broken
  21. ;; (ert-deftest test-org-table/org-table-convert-refs-to-an/2 ()
  22. ;; "Self reference @1$1."
  23. ;; (should
  24. ;; (string= "A1 = $0" (org-table-convert-refs-to-an "@1$1 = $0"))))
  25. (ert-deftest test-org-table/org-table-convert-refs-to-an/3 ()
  26. "Remote reference."
  27. (should
  28. (string= "C& = remote(FOO, @@#B&)" (org-table-convert-refs-to-an "$3 = remote(FOO, @@#$2)"))))
  29. (ert-deftest test-org-table/org-table-convert-refs-to-rc/1 ()
  30. "Simple reference @1$1."
  31. (should
  32. (string= "@1$1" (org-table-convert-refs-to-rc "A1"))))
  33. (ert-deftest test-org-table/org-table-convert-refs-to-rc/2 ()
  34. "Self reference $0."
  35. (should
  36. (string= "@1$1 = $0" (org-table-convert-refs-to-rc "A1 = $0"))))
  37. ;; TODO: Test Broken
  38. ;; (ert-deftest test-org-table/org-table-convert-refs-to-rc/3 ()
  39. ;; "Remote reference."
  40. ;; (should
  41. ;; (string= "$3 = remote(FOO, @@#$2)" (org-table-convert-refs-to-rc "C& = remote(FOO, @@#B&)"))))
  42. (ert-deftest test-org-table/simple-formula ()
  43. (org-test-at-id "563523f7-3f3e-49c9-9622-9216cc9a5d95"
  44. (re-search-forward (regexp-quote "#+tblname: simple-formula") nil t)
  45. (forward-line 1)
  46. (should (org-at-table-p))
  47. (should (org-table-recalculate 'all))
  48. (should (string= "10" (first (nth 5 (org-table-to-lisp)))))))
  49. (provide 'test-org-table)
  50. ;;; test-org-table.el ends here