emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org c033814 2/3: test-ob-R.el: add tests for output wit


From: ELPA Syncer
Subject: [elpa] externals/org c033814 2/3: test-ob-R.el: add tests for output with substrings matching prompt
Date: Sun, 2 May 2021 18:57:14 -0400 (EDT)

branch: externals/org
commit c0338142b77f5be5bd0512793341f668fb39289a
Author: Jeremie Juste <jeremiejuste@gmail.com>
Commit: Jeremie Juste <jeremiejuste@gmail.com>

    test-ob-R.el: add tests for output with substrings matching prompt
    
    * testing/lisp/test-ob-R.el (test-ob-r/output-with-<>): new test for output
      angle brackets
     (test-ob-R/output-nonprinted): New test for output results that aren't
    explicitly printed.  (Here all the lines are expected to be printed
    not just the last one)
    
    Patch suggested by Jack Kamm:
    https://orgmode.org/list/87h7slgbi5.fsf@gmail.com/
---
 testing/lisp/test-ob-R.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/testing/lisp/test-ob-R.el b/testing/lisp/test-ob-R.el
index 62d25ba..12eac83 100644
--- a/testing/lisp/test-ob-R.el
+++ b/testing/lisp/test-ob-R.el
@@ -97,6 +97,52 @@ x
      (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)))))))
+
+
+
+(ert-deftest test-ob-r/output-with-<> ()
+  "make sure angle brackets are well formatted"
+    (let (ess-ask-for-ess-directory ess-history-file)
+      (should (string="[1] \"<X> <Y> <!>\"
+[1] \"one <two> three\"
+[1] \"end35\"
+"
+  (org-test-with-temp-text "#+begin_src R :results output
+     print(\"<X> <Y> <!>\")
+     print(\"one <two> three\")
+     print(\"end35\")
+   #+end_src
+"
+    (org-babel-execute-src-block))
+))))
+
+
+;; (ert-deftest test-ob-r/output-with-error ()
+;;   "make sure angle brackets are well formatted"
+;;     (let (ess-ask-for-ess-directory ess-history-file)
+;;       (should (string="Error in print(1/a) : object 'a' not found"
+;;   (org-test-with-temp-text "#+begin_src R :results output
+;;   print(1/a)
+;;  #+end_src
+;; "
+;;     (org-babel-execute-src-block))
+;; ))))
+
+
+(ert-deftest test-ob-R/output-nonprinted ()
+  (let (ess-ask-for-ess-directory ess-history-file)
+    (org-test-with-temp-text
+     "#+begin_src R :results output
+4.0 * 3.5
+log(10)
+log10(10)
+(3 + 1) * 5
+3^-1
+1/0
+#+end_src"
+     (should (string= "[1] 14\n[1] 2.302585\n[1] 1\n[1] 20\n[1] 0.3333333\n[1] 
Inf\n" (org-babel-execute-src-block))))))
+
 (provide 'test-ob-R)
 
 ;;; test-ob-R.el ends here
+ 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]