test-ob-ruby.el 2.2 KB

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