test-ob-sqlite.el 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ;;; test-ob-sqlite.el --- tests for ob-sqlite.el
  2. ;; Copyright (C) 2017 Eduardo Bellani
  3. ;; Author: Eduardo Bellani <ebellani@gmail.com>
  4. ;; Keywords: lisp
  5. ;; This program is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; This program is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Code:
  16. (org-test-for-executable "sqlite")
  17. (unless (featurep 'ob-sqlite)
  18. (signal 'missing-test-dependency "Support for sqlite code blocks"))
  19. (ert-deftest ob-sqlite/table-variables-with-commas ()
  20. "Test of a table variable that contains commas. This garantees that this code path results in a valid CSV."
  21. (should
  22. (equal '(("Mr Test A. Sql"
  23. "Minister for Science, Eternal Happiness, and Finance"))
  24. (org-test-with-temp-text
  25. "#+name: test_table1
  26. | \"Mr Test A. Sql\" | Minister for Science, Eternal Happiness, and Finance |
  27. #+begin_src sqlite :db /tmp/test.db :var tb=test_table1
  28. drop table if exists TestTable;
  29. create table TestTable(person, job);
  30. .mode csv TestTable
  31. .import $tb TestTable
  32. select * from TestTable;
  33. #+end_src"
  34. (org-babel-next-src-block)
  35. (org-babel-execute-src-block)))))
  36. ;;; test-ob-sqlite.el ends here