If the stricter definition covers everything that org-babel-escape-script
was supposed to do... I agree we should keep it.
My problem was I wasn't sure if the function got pruned of something it
needed.

But if that's not the case...

On Tue, Aug 11, 2015 at 6:52 PM, Kyle Meyer <k...@kyleam.com> wrote:

> Feel free to wait to hear others' thoughts on this, but, in any case,
> please use 'git format-patch' to generate a patch with a commit message
> (see the contributing section of the website [1] for more information).
> Also, it'd be nice to add a test that catches the original error.
>

...here is the git format-patch of the ob-ruby.el change!

I also created one for a test to check for basic Ruby evaluation
capabilities. It should catch errors that break evaluation like this in
ob-ruby. (I find it interesting that the session tests worked without the
double-escape change actually.)
From 07052b4ad0f51f24534c5ee2899511cfb658ae71 Mon Sep 17 00:00:00 2001
From: Archenoth <archen...@gmail.com>
Date: Tue, 11 Aug 2015 20:29:53 -0600
Subject: [PATCH 1/2] Removed double-escape in ob-ruby.el (In
 org-babel-ruby-evaluate)

The only time org-babel-ruby-evaluate is called is in
org-babel-execute:ruby, where its result either escaped (The double
escape) or passed in as the "scalar-form" of org-babel-result-cond which
handles the "pp" and "code" parameters. (So, places that don't need
escaping.)
---
 lisp/ob-ruby.el | 6 +-----
 1 file changed, 1 insertion(+), 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
-- 
2.5.0

From 40864852d9f0996c4f755377a8326f2cbae417ec Mon Sep 17 00:00:00 2001
From: Archenoth <archen...@gmail.com>
Date: Tue, 11 Aug 2015 21:18:44 -0600
Subject: [PATCH 2/2] Add test that basic Ruby evaluation works with ob-ruby

This will also test that the string escape schenanigans are fixed.
---
 testing/lisp/test-ob-ruby.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

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

Reply via email to