Browse Source

Fix failing test

* testing/lisp/test-ob-lob.el (test-ob-lob/call-with-header-arguments):
  Fix failing test.
Nicolas Goaziou 5 months ago
parent
commit
bc8360c702
1 changed files with 59 additions and 35 deletions
  1. 59 35
      testing/lisp/test-ob-lob.el

+ 59 - 35
testing/lisp/test-ob-lob.el

@@ -41,41 +41,65 @@
   "Test the evaluation of a library of babel #+call: line."
   (letf (((symbol-function 'org-babel-insert-result)
 	  (symbol-function 'ignore)))
-    (org-test-at-id "fab7e291-fde6-45fc-bf6e-a485b8bca2f0"
-      (move-beginning-of-line 1)
-      (forward-line 6)
-      (message (buffer-substring (point-at-bol) (point-at-eol)))
-      (should (string= "testing" (org-babel-execute-src-block
-				  nil (org-babel-lob-get-info))))
-      (forward-line 1)
-      (should (string= "testing" (caar (org-babel-execute-src-block
-					nil (org-babel-lob-get-info)))))
-      (forward-line 1)
-      (should (string= "testing" (org-babel-execute-src-block
-				  nil (org-babel-lob-get-info))))
-      (forward-line 1)
-      (should (string= "testing" (caar (org-babel-execute-src-block
-					nil (org-babel-lob-get-info)))))
-      (forward-line 1)
-      (should (string= "testing" (org-babel-execute-src-block
-				  nil (org-babel-lob-get-info))))
-      (forward-line 1)
-      (should (string= "testing" (caar (org-babel-execute-src-block
-					nil (org-babel-lob-get-info)))))
-      (forward-line 1) (beginning-of-line) (forward-char 27)
-      (should (string= "testing" (org-babel-execute-src-block
-				  nil (org-babel-lob-get-info))))
-      (forward-line 1) (beginning-of-line) (forward-char 27)
-      (should (string= "testing" (caar (org-babel-execute-src-block
-					nil (org-babel-lob-get-info)))))
-      (forward-line 1) (beginning-of-line)
-      (should (= 4 (org-babel-execute-src-block nil (org-babel-lob-get-info))))
-      (forward-line 1)
-      (should (string= "testing" (org-babel-execute-src-block
-				  nil (org-babel-lob-get-info))))
-      (forward-line 1)
-      (should (string= "123" (org-babel-execute-src-block
-			      nil (org-babel-lob-get-info)))))))
+    (let ((org-babel-library-of-babel
+	   (org-test-with-temp-text-in-file
+	       "
+#+name: echo
+#+begin_src emacs-lisp :var input=\"echo'd\"
+  input
+#+end_src
+
+#+name: lob-minus
+#+begin_src emacs-lisp :var a=0 :var b=0
+  (- a b)
+#+end_src"
+	     (org-babel-lob-ingest)
+	     org-babel-library-of-babel)))
+      (org-test-at-id "fab7e291-fde6-45fc-bf6e-a485b8bca2f0"
+	(move-beginning-of-line 1)
+	(forward-line 6)
+	(message (buffer-substring (point-at-bol) (point-at-eol)))
+	(should
+	 (string= "testing" (org-babel-execute-src-block
+			     nil (org-babel-lob-get-info))))
+	(forward-line 1)
+	(should
+	 (string= "testing" (caar (org-babel-execute-src-block
+				   nil (org-babel-lob-get-info)))))
+	(forward-line 1)
+	(should
+	 (string= "testing" (org-babel-execute-src-block
+			     nil (org-babel-lob-get-info))))
+	(forward-line 1)
+	(should
+	 (string= "testing" (caar (org-babel-execute-src-block
+				   nil (org-babel-lob-get-info)))))
+	(forward-line 1)
+	(should
+	 (string= "testing" (org-babel-execute-src-block
+			     nil (org-babel-lob-get-info))))
+	(forward-line 1)
+	(should
+	 (string= "testing" (caar (org-babel-execute-src-block
+				   nil (org-babel-lob-get-info)))))
+	(forward-line 1) (beginning-of-line) (forward-char 27)
+	(should
+	 (string= "testing" (org-babel-execute-src-block
+			     nil (org-babel-lob-get-info))))
+	(forward-line 1) (beginning-of-line) (forward-char 27)
+	(should
+	 (string= "testing" (caar (org-babel-execute-src-block
+				   nil (org-babel-lob-get-info)))))
+	(forward-line 1) (beginning-of-line)
+	(should
+	 (= 4 (org-babel-execute-src-block nil (org-babel-lob-get-info))))
+	(forward-line 1)
+	(should
+	 (string= "testing" (org-babel-execute-src-block
+			     nil (org-babel-lob-get-info))))
+	(forward-line 1)
+	(should (string= "123" (org-babel-execute-src-block
+				nil (org-babel-lob-get-info))))))))
 
 (ert-deftest test-ob-lob/export-lob-lines ()
   "Test the export of a variety of library babel call lines."