From 7c849019341805e8814efecb11ea5bc1bd2a47e5 Mon Sep 17 00:00:00 2001 From: Archenoth Date: Tue, 11 Aug 2015 23:59:25 -0600 Subject: [PATCH] ob-ruby: Fix double-escaping * lisp/ob-ruby.el: Remove second call to `org-babel-ruby-table-or-string' in `org-babel-ruby-evaluate'. * testing/lisp/test-ob-ruby.el: Add test to verify `org-babel-execute:ruby' can evaluate Ruby code. (What the double-escape prevented) I removed the escaping from `org-babel-ruby-evaluate', because the only place `org-babel-ruby-evaluate' is ever called is in `org-babel-execute:ruby'. In this function, its result either escaped (Where the double escape previously occurred) or passed in as the "scalar-form" of `org-babel-result-cond', which handles the "pp" and "code" parameters. (A place that doesn't need escaping.) TINYCHANGE --- lisp/ob-ruby.el | 6 +----- testing/lisp/test-ob-ruby.el | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el index 9b01dbf..0ff460e 100644 --- a/lisp/ob-ruby.el +++ b/lisp/ob-ruby.el @@ -201,11 +201,7 @@ return the value of the last statement in BODY, as elisp." org-babel-ruby-pp-wrapper-method org-babel-ruby-wrapper-method) body (org-babel-process-file-name tmp-file 'noquote))) - (let ((raw (org-babel-eval-read-file tmp-file))) - (if (or (member "code" result-params) - (member "pp" result-params)) - raw - (org-babel-ruby-table-or-string raw)))))) + (org-babel-eval-read-file tmp-file)))) ;; comint session evaluation (case result-type (output diff --git a/testing/lisp/test-ob-ruby.el b/testing/lisp/test-ob-ruby.el index eb5233b..576cb13 100644 --- a/testing/lisp/test-ob-ruby.el +++ b/testing/lisp/test-ob-ruby.el @@ -21,6 +21,23 @@ (unless (featurep 'ob-ruby) (signal 'missing-test-dependency "Support for Ruby code blocks")) +(ert-deftest test-ob-ruby/basic-evaluation () + "Test that basic evaluation works." + (should (equal (org-test-with-temp-text "#+begin_src ruby + 2 + 2 +#+end_src" + (org-babel-execute-maybe) + (substring-no-properties + (buffer-string))) + "#+begin_src ruby + 2 + 2 +#+end_src + +#+RESULTS: +: 4 + +"))) + (ert-deftest test-ob-ruby/session-output-1 () (should (equal (org-test-with-temp-text "#+begin_src ruby :session :results output s = \"1\" -- 2.5.0