Browse Source

testing/lisp/test-ob-R.el: Initialize ESS vars for :session tests

* test-ob-R.el: (test-ob-R/simple-session, test-ob-R/results-file)
  tests start sessions.  As a consequence `ess-ask-for-ess-directory'
  and `ess-history-file' are let bound to `nil' to avoid prompting for
  the startup directory and using a history file.

Bug Reported by: Achim Gratz
Subject: [Bug] Testing: ESS (*R*, R (newest)) starting data directory?
Archived-At: <http://permalink.gmane.org/gmane.emacs.orgmode/104424>
Charles Berry 9 years ago
parent
commit
27b590c395
1 changed files with 14 additions and 12 deletions
  1. 14 12
      testing/lisp/test-ob-R.el

+ 14 - 12
testing/lisp/test-ob-R.el

@@ -26,7 +26,7 @@
   (signal 'missing-test-dependency "Support for R code blocks"))
 
 (ert-deftest test-ob-R/simple-session ()
-  (let ((ess-ask-for-ess-directory nil))
+  (let (ess-ask-for-ess-directory ess-history-file)
     (org-test-with-temp-text
      "#+begin_src R :session R\n  paste(\"Yep!\")\n#+end_src\n"
      (should (string= "Yep!" (org-babel-execute-src-block))))))
@@ -80,21 +80,23 @@ x
 		   (org-babel-execute-src-block)))))
 
 (ert-deftest test-ob-R/results-file ()
-  (org-test-with-temp-text "#+NAME: TESTSRC
+  (let (ess-ask-for-ess-directory ess-history-file)
+    (org-test-with-temp-text
+     "#+NAME: TESTSRC
 #+BEGIN_SRC R :results file
   a <- file.path(\"junk\", \"test.org\")
   a
 #+END_SRC"
-    (goto-char (point-min)) (org-babel-execute-maybe)
-    (org-babel-goto-named-result "TESTSRC") (forward-line 1)
-    (should (string= "[[file:junk/test.org]]"
-		     (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
-    (goto-char (point-min)) (forward-line 1)
-    (insert "#+header: :session\n")
-    (goto-char (point-min)) (org-babel-execute-maybe)
-    (org-babel-goto-named-result "TESTSRC") (forward-line 1)
-    (should (string= "[[file:junk/test.org]]"
-		     (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
+     (goto-char (point-min)) (org-babel-execute-maybe)
+     (org-babel-goto-named-result "TESTSRC") (forward-line 1)
+     (should (string= "[[file:junk/test.org]]"
+		      (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
+     (goto-char (point-min)) (forward-line 1)
+     (insert "#+header: :session\n")
+     (goto-char (point-min)) (org-babel-execute-maybe)
+     (org-babel-goto-named-result "TESTSRC") (forward-line 1)
+     (should (string= "[[file:junk/test.org]]"
+		      (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))))
 (provide 'test-ob-R)
 
 ;;; test-ob-R.el ends here