Browse Source

Test support of explicitly specified colnames

* test-ob.el (test-ob/specific-colnames): Add test checking that given column
names are well present in the output table.
Sebastien Vauban 12 years ago
parent
commit
bc8b8fbcf0
1 changed files with 32 additions and 0 deletions
  1. 32 0
      testing/lisp/test-ob.el

+ 32 - 0
testing/lisp/test-ob.el

@@ -1106,6 +1106,38 @@ Paragraph"
     (widen)
     (should (should (re-search-forward "^: 3" nil t)))))
 
+(ert-deftest test-ob/specific-colnames ()
+  "Test passing specific column names."
+  (should
+   (equal "#+name: input-table
+| id | var1 |
+|----+------|
+|  1 | bar  |
+|  2 | baz  |
+
+#+begin_src sh :var data=input-table :exports results :colnames '(Rev Author)
+echo \"$data\"
+#+end_src
+
+#+results:
+| Rev | Author |
+|-----+--------|
+|   1 | bar    |
+|   2 | baz    |
+
+"
+	  (org-test-with-temp-text "#+name: input-table
+| id | var1 |
+|----+------|
+|  1 | bar  |
+|  2 | baz  |
+
+#+begin_src sh :var data=input-table :exports results :colnames '(Rev Author)
+echo \"$data\"
+#+end_src
+"
+				   (org-babel-execute-src-block)
+				   (buffer-string)))))
 
 (provide 'test-ob)