2013-10-21 07:03:28 -04:00
|
|
|
;;; test-ob-ruby.el --- tests for ob-ruby.el
|
|
|
|
|
2019-01-01 05:50:56 -05:00
|
|
|
;; Copyright (c) 2013-2015, 2019 Oleh Krehel
|
2013-10-21 07:03:28 -04:00
|
|
|
;; Authors: Oleh Krehel
|
|
|
|
|
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
(org-test-for-executable "ruby")
|
|
|
|
(unless (featurep 'ob-ruby)
|
|
|
|
(signal 'missing-test-dependency "Support for Ruby code blocks"))
|
|
|
|
|
2014-09-21 11:59:49 -04:00
|
|
|
(ert-deftest test-ob-ruby/session-output-1 ()
|
2019-05-12 09:20:40 -04:00
|
|
|
(should (equal (org-test-with-temp-text "#+begin_src ruby :session org-test-ruby :results output
|
2013-10-21 07:03:28 -04:00
|
|
|
s = \"1\"
|
|
|
|
s = \"2\"
|
|
|
|
s = \"3\"
|
|
|
|
puts s
|
2019-05-12 09:20:40 -04:00
|
|
|
s = \"4\"
|
2013-10-21 07:03:28 -04:00
|
|
|
#+end_src"
|
2015-01-30 08:23:54 -05:00
|
|
|
(org-babel-execute-maybe)
|
2013-10-21 07:03:28 -04:00
|
|
|
(substring-no-properties
|
|
|
|
(buffer-string)))
|
2019-05-12 09:20:40 -04:00
|
|
|
"#+begin_src ruby :session org-test-ruby :results output
|
2013-10-21 07:03:28 -04:00
|
|
|
s = \"1\"
|
|
|
|
s = \"2\"
|
|
|
|
s = \"3\"
|
|
|
|
puts s
|
2019-05-12 09:20:40 -04:00
|
|
|
s = \"4\"
|
2013-10-21 07:03:28 -04:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
#+RESULTS:
|
|
|
|
: 3
|
2014-09-21 11:59:49 -04:00
|
|
|
")))
|
|
|
|
(ert-deftest test-ob-ruby/session-output-2 ()
|
2019-05-12 09:20:40 -04:00
|
|
|
(should (equal (org-test-with-temp-text "#+begin_src ruby :session org-test-ruby :results output
|
2014-09-21 11:59:49 -04:00
|
|
|
puts s
|
2019-05-12 09:20:40 -04:00
|
|
|
s = \"5\"
|
2014-09-21 11:59:49 -04:00
|
|
|
#+end_src"
|
2015-01-30 08:23:54 -05:00
|
|
|
(org-babel-execute-maybe)
|
2014-09-21 11:59:49 -04:00
|
|
|
(substring-no-properties
|
|
|
|
(buffer-string)))
|
2019-05-12 09:20:40 -04:00
|
|
|
"#+begin_src ruby :session org-test-ruby :results output
|
2014-09-21 11:59:49 -04:00
|
|
|
puts s
|
2019-05-12 09:20:40 -04:00
|
|
|
s = \"5\"
|
2014-09-21 11:59:49 -04:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
#+RESULTS:
|
2019-05-12 09:20:40 -04:00
|
|
|
: 4
|
2014-09-21 11:59:49 -04:00
|
|
|
")))
|
|
|
|
(ert-deftest test-ob-ruby/session-output-3 ()
|
2019-05-12 09:20:40 -04:00
|
|
|
(should (equal (org-test-with-temp-text "#+begin_src ruby :session org-test-ruby :results output
|
2014-09-21 11:59:49 -04:00
|
|
|
puts s
|
2019-05-12 09:20:40 -04:00
|
|
|
s = \"6\"
|
2014-09-21 11:59:49 -04:00
|
|
|
#+end_src"
|
2015-01-30 08:23:54 -05:00
|
|
|
(org-babel-execute-maybe)
|
2014-09-21 11:59:49 -04:00
|
|
|
(substring-no-properties
|
|
|
|
(buffer-string)))
|
2019-05-12 09:20:40 -04:00
|
|
|
"#+begin_src ruby :session org-test-ruby :results output
|
2014-09-21 11:59:49 -04:00
|
|
|
puts s
|
2019-05-12 09:20:40 -04:00
|
|
|
s = \"6\"
|
2014-09-21 11:59:49 -04:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
#+RESULTS:
|
|
|
|
: 5
|
2013-10-21 07:03:28 -04:00
|
|
|
")))
|
|
|
|
|
|
|
|
(provide 'test-ob-ruby)
|
|
|
|
|
|
|
|
;;; test-ob-ruby.el ends here
|