Fix new test for clocktables
[org-mode.git] / testing / lisp / test-org-table.el
blobcdcc5dd0b95a4879dd86e9b94f590860c2d2bdc9
1 ;;; test-org-table.el
3 ;; Copyright (c) ߛ David Maus
4 ;; Authors: David Maus
6 ;; Released under the GNU General Public License version 3
7 ;; see: http://www.gnu.org/licenses/gpl-3.0.html
9 ;;;; Comments:
11 ;; Template test file for Org-mode tests
13 ;;; Code:
14 (ert-deftest test-org-table/org-table-convert-refs-to-an/1 ()
15 "Simple reference @1$1."
16 (should
17 (string= "A1" (org-table-convert-refs-to-an "@1$1"))))
19 ;; TODO: Test broken
20 ;; (ert-deftest test-org-table/org-table-convert-refs-to-an/2 ()
21 ;; "Self reference @1$1."
22 ;; (should
23 ;; (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)"))))
30 (ert-deftest test-org-table/org-table-convert-refs-to-rc/1 ()
31 "Simple reference @1$1."
32 (should
33 (string= "@1$1" (org-table-convert-refs-to-rc "A1"))))
35 (ert-deftest test-org-table/org-table-convert-refs-to-rc/2 ()
36 "Self reference $0."
37 (should
38 (string= "@1$1 = $0" (org-table-convert-refs-to-rc "A1 = $0"))))
40 ;; TODO: Test Broken
41 ;; (ert-deftest test-org-table/org-table-convert-refs-to-rc/3 ()
42 ;; "Remote reference."
43 ;; (should
44 ;; (string= "$3 = remote(FOO, @@#$2)" (org-table-convert-refs-to-rc "C& = remote(FOO, @@#B&)"))))
46 (ert-deftest test-org-table/simple-formula ()
47 (org-test-with-temp-text-in-file "
49 * simple formula
50 :PROPERTIES:
51 :ID: 563523f7-3f3e-49c9-9622-9216cc9a5d95
52 :END:
54 #+tblname: simple-formula
55 | 1 |
56 | 2 |
57 | 3 |
58 | 4 |
59 |----|
60 | |
61 #+TBLFM: $1=vsum(@1..@-1)
63 (progn
64 (re-search-forward (regexp-quote "#+tblname: simple-formula") nil t)
65 (forward-line 1)
66 (should (org-at-table-p))
67 (should (org-table-recalculate 'all))
68 (should (string= "10" (first (nth 5 (org-table-to-lisp))))))))
70 (provide 'test-org-table)
72 ;;; test-org-table.el ends here