From 9014577df289322e4eb294ebcf7c7fbfb9d1a414 Mon Sep 17 00:00:00 2001 From: Jeremie Juste Date: Mon, 3 May 2021 00:23:36 +0200 Subject: [PATCH] test-ob-R.el: add tests for how NA values are printed * testing/lisp/test-ob-R.el (ert-deftest test-ob-r/NA-blank): new test for :results value. Make sure that NA values in R data.frames are empty string instead of nil previously see https://orgmode.org/list/87pn1dufm2.fsf@gmail.com/ --- testing/lisp/test-ob-R.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/testing/lisp/test-ob-R.el b/testing/lisp/test-ob-R.el index 12eac83ec..c36bac9e6 100644 --- a/testing/lisp/test-ob-R.el +++ b/testing/lisp/test-ob-R.el @@ -142,6 +142,15 @@ log10(10) #+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)))))) +(ert-deftest test-ob-r/NA-blank () + "For :results value, NAs should be empty" + (let (ess-ask-for-ess-directory ess-history-file) + (should (equal '(("A" "B") hline ("" 1) (1 2) (1 "") (1 4) (1 4)) + (org-test-with-temp-text "#+BEGIN_SRC R :results value :colnames yes + data.frame(A=c(NA,1,1,1,1),B=c(1,2,NA,4,4)) +#+end_src" + (org-babel-execute-src-block)))))) + (provide 'test-ob-R) ;;; test-ob-R.el ends here