Kaynağa Gözat

test: more tests of exporting call lines in a variety of situations

Eric Schulte 13 yıl önce
ebeveyn
işleme
214acebac9
2 değiştirilmiş dosya ile 48 ekleme ve 0 silme
  1. 26 0
      testing/examples/babel.org
  2. 22 0
      testing/lisp/test-ob-lob.el

+ 26 - 0
testing/examples/babel.org

@@ -158,6 +158,32 @@ This is an inline call call_echo(input="testing")[:results vector] embedded in p
 #+call: lob-minus(8, 4)
 call_echo("testing")
 
+* exporting an lob call line
+  :PROPERTIES:
+  :ID:       72ddeed3-2d17-4c7f-8192-a575d535d3fc
+  :END:
+
+#+source: double
+#+begin_src emacs-lisp :var it=0
+  (* 2 it)
+#+end_src
+
+The following exports as a normal call line
+#+call: double(it=0)
+
+Now here is an inline call call_double(it=1) stuck in the middle of
+some prose.
+
+This one should not be exported =call_double(it=2)= because it is
+quoted.
+
+Finally this next one should export, even though it starts a line
+call_double(it=3) because sometimes inline blocks fold with a
+paragraph.
+
+And, a call with raw results call_double(4)[:results raw] should not
+have quoted results.
+
 * parsing header arguments
   :PROPERTIES:
   :ID:       7eb0dc6e-1c53-4275-88b3-b22f3113b9c3

+ 22 - 0
testing/lisp/test-ob-lob.el

@@ -61,6 +61,28 @@
     (should (string= "testing" (org-babel-lob-execute
 				(org-babel-lob-get-info))))))
 
+(ert-deftest test-ob-lob/export-lob-lines ()
+  "Test the export of a variety of library babel call lines."
+  (org-test-at-id "72ddeed3-2d17-4c7f-8192-a575d535d3fc"
+    (org-narrow-to-subtree)
+    (let ((html (org-export-as-html nil nil nil 'string 'body-only)))
+      ;; check the location of each exported number
+      (with-temp-buffer
+	(insert html) (goto-char (point-min))
+	;; 0 should be on a line by itself
+	(should (re-search-forward "0" nil t))
+	(should (string= "0" (buffer-substring (point-at-bol) (point-at-eol))))
+	;; 2 should be in <code> tags
+	(should (re-search-forward "2" nil t))
+	(should (re-search-forward (regexp-quote "</code>") (point-at-eol) t))
+	(should (re-search-backward (regexp-quote "<code>") (point-at-bol) t))
+	;; 4 should not be exported
+	(should (not (re-search-forward "4" nil t)))
+	;; 6 should also be inline
+	(should (re-search-forward "6" nil t))
+	(should (re-search-forward (regexp-quote "</code>") (point-at-eol) t))
+	(should (re-search-backward (regexp-quote "<code>") (point-at-bol) t))))))
+
 (provide 'test-ob-lob)
 
 ;;; test-ob-lob.el ends here