summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2011-07-04 12:13:41 -0600
committerEric Schulte <schulte.eric@gmail.com>2011-07-04 12:13:41 -0600
commitc22c904718db901d90bd7f97034f73f9453ef288 (patch)
tree2c7e696f8ada578c38e420ba8cf941a23bf883f4
parent20401ecd6d932dcaa6894a56dfb0da228172845d (diff)
downloadorg-mode-c22c904718db901d90bd7f97034f73f9453ef288.tar.gz
test: adding simple regression test for table formula evaluation
-rw-r--r--testing/examples/table.org19
-rw-r--r--testing/lisp/test-org-table.el12
2 files changed, 29 insertions, 2 deletions
diff --git a/testing/examples/table.org b/testing/examples/table.org
new file mode 100644
index 0000000..3c6caed
--- /dev/null
+++ b/testing/examples/table.org
@@ -0,0 +1,19 @@
+#+TITLE: example file with tables
+#+OPTIONS: num:nil ^:nil
+
+This is an example file for use by the Org-mode tests defined in
+file:../lisp/test-org-table.el.
+
+* simple formula
+ :PROPERTIES:
+ :ID: 563523f7-3f3e-49c9-9622-9216cc9a5d95
+ :END:
+
+#+tblname: simple-formula
+| 1 |
+| 2 |
+| 3 |
+| 4 |
+|----|
+| 10 |
+ #+TBLFM: $1=vsum(@1..@-1)
diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el
index 7e0960e..3ecc384 100644
--- a/testing/lisp/test-org-table.el
+++ b/testing/lisp/test-org-table.el
@@ -26,7 +26,7 @@
(should
(string= "A1" (org-table-convert-refs-to-an "@1$1"))))
-;; TODO Test broken
+;; TODO: Test broken
;; (ert-deftest test-org-table/org-table-convert-refs-to-an/2 ()
;; "Self reference @1$1."
;; (should
@@ -47,12 +47,20 @@
(should
(string= "@1$1 = $0" (org-table-convert-refs-to-rc "A1 = $0"))))
-;; TODO Test Broken
+;; TODO: Test Broken
;; (ert-deftest test-org-table/org-table-convert-refs-to-rc/3 ()
;; "Remote reference."
;; (should
;; (string= "$3 = remote(FOO, @@#$2)" (org-table-convert-refs-to-rc "C& = remote(FOO, @@#B&)"))))
+(ert-deftest test-org-table/simple-formula ()
+ (org-test-at-id "563523f7-3f3e-49c9-9622-9216cc9a5d95"
+ (re-search-forward (regexp-quote "#+tblname: simple-formula") nil t)
+ (forward-line 1)
+ (should (org-at-table-p))
+ (should (org-table-recalculate 'all))
+ (should (string= "10" (first (nth 5 (org-table-to-lisp)))))))
+
(provide 'test-org-table)
;;; test-org-table.el ends here