Browse Source

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/
Jeremie Juste 3 years ago
parent
commit
9014577df2
1 changed files with 9 additions and 0 deletions
  1. 9 0
      testing/lisp/test-ob-R.el

+ 9 - 0
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