org-e-ascii: Less blank lines in document's title when no author is provided
[org-mode.git] / testing / lisp / test-org-table.el
blob26eb47bec3978e8b6ecdf5c79f6576cd643b10ea
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
14 ;;; Code:
15 (let ((load-path (cons (expand-file-name
16 ".." (file-name-directory
17 (or load-file-name buffer-file-name)))
18 load-path)))
19 (require 'org-test)
20 (require 'org-test-ob-consts))
23 ;;; Tests
24 (ert-deftest test-org-table/org-table-convert-refs-to-an/1 ()
25 "Simple reference @1$1."
26 (should
27 (string= "A1" (org-table-convert-refs-to-an "@1$1"))))
29 ;; TODO: Test broken
30 ;; (ert-deftest test-org-table/org-table-convert-refs-to-an/2 ()
31 ;; "Self reference @1$1."
32 ;; (should
33 ;; (string= "A1 = $0" (org-table-convert-refs-to-an "@1$1 = $0"))))
35 (ert-deftest test-org-table/org-table-convert-refs-to-an/3 ()
36 "Remote reference."
37 (should
38 (string= "C& = remote(FOO, @@#B&)" (org-table-convert-refs-to-an "$3 = remote(FOO, @@#$2)"))))
40 (ert-deftest test-org-table/org-table-convert-refs-to-rc/1 ()
41 "Simple reference @1$1."
42 (should
43 (string= "@1$1" (org-table-convert-refs-to-rc "A1"))))
45 (ert-deftest test-org-table/org-table-convert-refs-to-rc/2 ()
46 "Self reference $0."
47 (should
48 (string= "@1$1 = $0" (org-table-convert-refs-to-rc "A1 = $0"))))
50 ;; TODO: Test Broken
51 ;; (ert-deftest test-org-table/org-table-convert-refs-to-rc/3 ()
52 ;; "Remote reference."
53 ;; (should
54 ;; (string= "$3 = remote(FOO, @@#$2)" (org-table-convert-refs-to-rc "C& = remote(FOO, @@#B&)"))))
56 (ert-deftest test-org-table/simple-formula ()
57 (org-test-with-temp-text-in-file "
59 * simple formula
60 :PROPERTIES:
61 :ID: 563523f7-3f3e-49c9-9622-9216cc9a5d95
62 :END:
64 #+tblname: simple-formula
65 | 1 |
66 | 2 |
67 | 3 |
68 | 4 |
69 |----|
70 | |
71 #+TBLFM: $1=vsum(@1..@-1)
73 (progn
74 (re-search-forward (regexp-quote "#+tblname: simple-formula") nil t)
75 (forward-line 1)
76 (should (org-at-table-p))
77 (should (org-table-recalculate 'all))
78 (should (string= "10" (first (nth 5 (org-table-to-lisp))))))))
80 (provide 'test-org-table)
82 ;;; test-org-table.el ends here