branch: externals/org
commit e5be37422fab8f7e73e3aedcec4bbacfb3dcf351
Author: Simon Cossar <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    testing/lisp/test-ob-clojure.el: Add tests
    
    * test-ob-clojure.el (ob-clojure/org-babel-tangle): Test that when a
    source block's :results parameter is set to "value", the tangled code
    does not include `prn' statements.
    (ob-clojure/org-babel-execute): Test that :result-params "value" and
    "output" values are correctly handled.
    
    TINYCHANGE
---
 testing/lisp/test-ob-clojure.el | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/testing/lisp/test-ob-clojure.el b/testing/lisp/test-ob-clojure.el
index 4784f33c6eb..e4e02f78325 100644
--- a/testing/lisp/test-ob-clojure.el
+++ b/testing/lisp/test-ob-clojure.el
@@ -23,13 +23,37 @@
 ;; Org tests for ob-clojure.el live here
 
 ;;; Code:
-
 (require 'org-test "../testing/org-test")
 
 (unless (featurep 'ob-clojure)
   (signal 'missing-test-dependency '("Support for Clojure code blocks")))
 
-;; FIXME: The old tests where totally off.  We need to write new tests.
+;; tangle
+(ert-deftest ob-clojure/org-babel-tangle ()
+  "org-babel-tangle returns the exact body of the source block."
+  (org-test-with-temp-text-in-file
+   "#+begin_src clojure :tangle \"tangle.clj\" :results value\n
+(+ 1 2)\n#+end_src"
+   (unwind-protect
+       (progn (org-babel-tangle)
+              (with-temp-buffer
+                (insert-file-contents "tangle.clj")
+                (let ((tangled (buffer-string)))
+                  (should
+                   (string-match-p "^(\\+ 1 2)\\\n$" tangled)))))
+     (delete-file "tangle.clj"))))
+
+;; execute
+(ert-deftest ob-clojure/org-babel-execute ()
+  "org-babel-execute:clojure correctly handles :result-params."
+  (should (equal 3
+                 (org-babel-execute:clojure
+                  "(+ 1 2)"
+                  '((:result-params "value")))))
+  (should (equal ""
+                 (org-babel-execute:clojure
+                  "(+ 1 2)"
+                  '((:result-params "output"))))))
 
 (provide 'test-ob-clojure)
 

Reply via email to