test-ob-table.el 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ;;; test-ob-table.el
  2. ;; Copyright (c) 2011-2014 Eric Schulte
  3. ;; Authors: Eric Schulte
  4. ;; This file is not part of GNU Emacs.
  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. ;;; Comments:
  16. ;; Template test file for Org tests
  17. ;;; Code:
  18. ;; TODO Test Broken (wrong-type-argument number-or-marker-p "2.0")
  19. ;; (ert-deftest test-ob-table/sbe ()
  20. ;; "Test that `sbe' can be used to call code blocks from inside tables."
  21. ;; (org-test-at-id "6d2ff4ce-4489-4e2a-9c65-e3f71f77d975"
  22. ;; (should (= 2 (sbe take-sqrt (n "4"))))))
  23. (ert-deftest test-ob-table/sbe-quote ()
  24. "Test that `org-sbe' can correctly handle cell values containing quotes."
  25. (org-test-table-target-expect
  26. "
  27. #+name: identity
  28. #+begin_src emacs-lisp :eval yes
  29. x
  30. #+end_src
  31. | a\"b\"c | replace |
  32. "
  33. "
  34. #+name: identity
  35. #+begin_src emacs-lisp :eval yes
  36. x
  37. #+end_src
  38. | a\"b\"c | a\"b\"c |
  39. "
  40. 1
  41. "#+TBLFM: $2 = '(org-sbe identity (x $$1))"))
  42. (ert-deftest test-ob-table/sbe-list ()
  43. "Test that `org-sbe' can correctly handle ranges as lists."
  44. (org-test-table-target-expect
  45. "
  46. #+name: concat
  47. #+begin_src emacs-lisp :eval yes
  48. (mapconcat #'identity x \"\")
  49. #+end_src
  50. | foo | bar | replace |
  51. "
  52. "
  53. #+name: concat
  54. #+begin_src emacs-lisp :eval yes
  55. (mapconcat #'identity x \"\")
  56. #+end_src
  57. | foo | bar | foobar |
  58. "
  59. 1
  60. "#+TBLFM: $3 = '(org-sbe concat (x (list $1..$2)))"
  61. "#+TBLFM: $3 = '(org-sbe concat (x $ (list $1..$2)))"))
  62. (provide 'test-ob-table)
  63. ;;; test-ob-table.el ends here