test-ob-ruby.el 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ;;; test-ob-ruby.el --- tests for ob-ruby.el
  2. ;; Copyright (c) 2013-2015 Oleh Krehel
  3. ;; Authors: Oleh Krehel
  4. ;; This program is free software; you can redistribute it and/or modify
  5. ;; it under the terms of the GNU General Public License as published by
  6. ;; the Free Software Foundation, either version 3 of the License, or
  7. ;; (at your option) any later version.
  8. ;; This program is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;; GNU General Public License for more details.
  12. ;; You should have received a copy of the GNU General Public License
  13. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. ;;; Code:
  15. (org-test-for-executable "ruby")
  16. (unless (featurep 'ob-ruby)
  17. (signal 'missing-test-dependency "Support for Ruby code blocks"))
  18. (ert-deftest test-ob-ruby/session-output-1 ()
  19. (should (equal (org-test-with-temp-text "#+begin_src ruby :session :results output
  20. s = \"1\"
  21. s = \"2\"
  22. s = \"3\"
  23. puts s
  24. #+end_src"
  25. (org-babel-execute-maybe)
  26. (substring-no-properties
  27. (buffer-string)))
  28. "#+begin_src ruby :session :results output
  29. s = \"1\"
  30. s = \"2\"
  31. s = \"3\"
  32. puts s
  33. #+end_src
  34. #+RESULTS:
  35. : 3
  36. ")))
  37. (ert-deftest test-ob-ruby/session-output-2 ()
  38. (should (equal (org-test-with-temp-text "#+begin_src ruby :session :results output
  39. s = \"5\"
  40. puts s
  41. #+end_src"
  42. (org-babel-execute-maybe)
  43. (substring-no-properties
  44. (buffer-string)))
  45. "#+begin_src ruby :session :results output
  46. s = \"5\"
  47. puts s
  48. #+end_src
  49. #+RESULTS:
  50. : 5
  51. ")))
  52. (ert-deftest test-ob-ruby/session-output-3 ()
  53. (should (equal (org-test-with-temp-text "#+begin_src ruby :session :results output
  54. puts s
  55. #+end_src"
  56. (org-babel-execute-maybe)
  57. (substring-no-properties
  58. (buffer-string)))
  59. "#+begin_src ruby :session :results output
  60. puts s
  61. #+end_src
  62. #+RESULTS:
  63. : 5
  64. ")))
  65. (provide 'test-ob-ruby)
  66. ;;; test-ob-ruby.el ends here