From ffb30cd7373a59e484bfa78c773ea1f46e7fbb41 Mon Sep 17 00:00:00 2001 From: Jeremie Juste Date: Sat, 3 Dec 2022 21:02:25 +0100 Subject: test-ob-R.el: Add tests for :results output * test-ob-R.el (ob-session-R-results-output, ob-session-R-results-output-no-drawer): Two new functions to test that :results works as expected with and without drawers. This commit is to ensure that the bug reported in https://list.orgmode.org/87h6yel4vr.fsf@localhost/, does not happen again. --- testing/lisp/test-ob-R.el | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/testing/lisp/test-ob-R.el b/testing/lisp/test-ob-R.el index f6143b994bf..b4a927f3972 100644 --- a/testing/lisp/test-ob-R.el +++ b/testing/lisp/test-ob-R.el @@ -248,6 +248,39 @@ log10(10) +;; add test for results output +(ert-deftest ob-session-R-results-output () + (let (ess-ask-for-ess-directory + ess-history-file + org-confirm-babel-evaluate + (org-babel-temporary-directory "/tmp") + (src-block "#+begin_src R :session R :results output drawer\n 1:5\n#+end_src") + (result "\n\n#+RESULTS:\n:results:\n[1] 1 2 3 4 5\n:end:\n")) + (org-test-with-temp-text + src-block + (should (progn (org-babel-execute-src-block) + (sleep-for 0 200) + (string= (concat src-block result) + (buffer-string))))))) + + +;; add test for result without drawer +(ert-deftest ob-session-R-results-output-no-drawer () + (let (ess-ask-for-ess-directory + ess-history-file + org-confirm-babel-evaluate + (org-babel-temporary-directory "/tmp") + (src-block "#+begin_src R :session R :results output \n 1:5\n#+end_src") + (result "\n\n#+RESULTS:\n: [1] 1 2 3 4 5\n")) + (org-test-with-temp-text + src-block + (should (progn (org-babel-execute-src-block) + (sleep-for 0 200) + (string= (concat src-block result) + (buffer-string))))))) + + + (provide 'test-ob-R) -- cgit v1.2.1