1 ;;; test-org-table.el --- tests for org-table.el
3 ;; Copyright (c) David Maus
6 ;; This file is not part of GNU Emacs.
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
23 ;; Template test file for Org-mode tests
26 (ert-deftest test-org-table
/org-table-convert-refs-to-an
/1 ()
27 "Simple reference @1$1."
29 (string= "A1" (org-table-convert-refs-to-an "@1$1"))))
32 ;; (ert-deftest test-org-table/org-table-convert-refs-to-an/2 ()
33 ;; "Self reference @1$1."
35 ;; (string= "A1 = $0" (org-table-convert-refs-to-an "@1$1 = $0"))))
37 (ert-deftest test-org-table
/org-table-convert-refs-to-an
/3 ()
40 (string= "C& = remote(FOO, @@#B&)" (org-table-convert-refs-to-an "$3 = remote(FOO, @@#$2)"))))
42 (ert-deftest test-org-table
/org-table-convert-refs-to-rc
/1 ()
43 "Simple reference @1$1."
45 (string= "@1$1" (org-table-convert-refs-to-rc "A1"))))
47 (ert-deftest test-org-table
/org-table-convert-refs-to-rc
/2 ()
50 (string= "@1$1 = $0" (org-table-convert-refs-to-rc "A1 = $0"))))
53 ;; (ert-deftest test-org-table/org-table-convert-refs-to-rc/3 ()
54 ;; "Remote reference."
56 ;; (string= "$3 = remote(FOO, @@#$2)" (org-table-convert-refs-to-rc "C& = remote(FOO, @@#B&)"))))
58 (ert-deftest test-org-table
/simple-formula
()
59 (org-test-with-temp-text-in-file "
63 :ID: 563523f7-3f3e-49c9-9622-9216cc9a5d95
66 #+tblname: simple-formula
73 #+TBLFM: $1=vsum(@1..@-1)
76 (re-search-forward (regexp-quote "#+tblname: simple-formula") nil t
)
78 (should (org-at-table-p))
79 (should (org-table-recalculate 'all
))
80 (should (string= "10" (first (nth 5 (org-table-to-lisp))))))))
82 (provide 'test-org-table
)
84 ;;; test-org-table.el ends here