test-ob-ruby.el 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ;;; test-ob-ruby.el --- tests for ob-ruby.el -*- lexical-binding: t; -*-
  2. ;; Copyright (c) 2013-2015, 2019 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 <https://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 org-test-ruby :results output
  20. s = \"1\"
  21. s = \"2\"
  22. s = \"3\"
  23. puts s
  24. s = \"4\"
  25. #+end_src"
  26. (org-babel-execute-maybe)
  27. (substring-no-properties
  28. (buffer-string)))
  29. "#+begin_src ruby :session org-test-ruby :results output
  30. s = \"1\"
  31. s = \"2\"
  32. s = \"3\"
  33. puts s
  34. s = \"4\"
  35. #+end_src
  36. #+RESULTS:
  37. : 3
  38. ")))
  39. (ert-deftest test-ob-ruby/session-output-2 ()
  40. (should (equal (org-test-with-temp-text "#+begin_src ruby :session org-test-ruby :results output
  41. puts s
  42. s = \"5\"
  43. #+end_src"
  44. (org-babel-execute-maybe)
  45. (substring-no-properties
  46. (buffer-string)))
  47. "#+begin_src ruby :session org-test-ruby :results output
  48. puts s
  49. s = \"5\"
  50. #+end_src
  51. #+RESULTS:
  52. : 4
  53. ")))
  54. (ert-deftest test-ob-ruby/session-output-3 ()
  55. (should (equal (org-test-with-temp-text "#+begin_src ruby :session org-test-ruby :results output
  56. puts s
  57. s = \"6\"
  58. #+end_src"
  59. (org-babel-execute-maybe)
  60. (substring-no-properties
  61. (buffer-string)))
  62. "#+begin_src ruby :session org-test-ruby :results output
  63. puts s
  64. s = \"6\"
  65. #+end_src
  66. #+RESULTS:
  67. : 5
  68. ")))
  69. (provide 'test-ob-ruby)
  70. ;;; test-ob-ruby.el ends here