Przeglądaj źródła

Merge branch 'origin-maint'

Conflicts:
	testing/lisp/test-ob.el
Eric Schulte 13 lat temu
rodzic
commit
d03b013e2c
1 zmienionych plików z 66 dodań i 0 usunięć
  1. 66 0
      testing/lisp/test-ob.el

+ 66 - 0
testing/lisp/test-ob.el

@@ -863,6 +863,72 @@ Line 3\"
 
 * next heading"))
 
+(ert-deftest test-org-babel/inline-src_blk-preceded-punct-preceded-by-point ()
+  (let ((test-line ".src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
+    (org-test-with-temp-text
+	test-line
+      (forward-char 1)
+      (org-ctrl-c-ctrl-c)
+      (should (string= (concat test-line " =\"x\"=")
+		       (buffer-substring-no-properties
+			(point-min) (point-max)))))))
+
+(ert-deftest test-org-babel/inline-src-block-preceded-by-equality ()
+  (let ((test-line "=src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
+    (org-test-with-temp-text
+	test-line
+      (forward-char 1)
+      (org-ctrl-c-ctrl-c)
+      (should (string= (concat test-line " =\"x\"=")
+		       (buffer-substring-no-properties
+			(point-min) (point-max)))))))
+
+(ert-deftest test-org-babel/inline-src-block-enclosed-within-parenthesis ()
+  (let ((test-line "(src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
+    (org-test-with-temp-text
+	(concat test-line ")")
+      (forward-char 1)
+      (org-ctrl-c-ctrl-c)
+      (should (string= (concat test-line " =\"x\"=)" )
+		       (buffer-substring-no-properties
+			(point-min) (point-max)))))))
+
+(ert-deftest test-org-babel/inline-src-block-enclosed-within-parenthesis ()
+  (let ((test-line "{src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
+    (org-test-with-temp-text
+	(concat test-line "}")
+      (forward-char 1)
+      (org-ctrl-c-ctrl-c)
+      (should (string= (concat test-line " =\"x\"=}")
+		       (buffer-substring-no-properties
+			(point-min) (point-max)))))))
+
+(ert-deftest test-org-babel/inline-src_blk-preceded-by-letter ()
+  "Test inline source block invalid where preceded by letter"
+
+  ;; inline-src-blk preceded by letter
+  (org-test-with-temp-text
+      "asrc_emacs-lisp[ :results verbatim ]{ \"x\"  }"
+    (forward-char 1)
+    (let ((error-result
+	   (should-error
+	    (org-ctrl-c-ctrl-c))))
+      (should (equal `(error "C-c C-c can do nothing useful at this location")
+		     error-result)))))
+
+(ert-deftest test-org-babel/inline-src_blk-preceded-by-number ()
+  "Test inline source block invalid where preceded by number"
+
+  ;; inline-src-blk preceded by number
+  (org-test-with-temp-text
+      "0src_emacs-lisp[ :results verbatim ]{ \"x\"  }"
+    (forward-char 1)
+    (let ((error-result
+	   (should-error
+	    (org-ctrl-c-ctrl-c))))
+      (should (equal `(error "C-c C-c can do nothing useful at this location")
+		     error-result)))))
+
 (provide 'test-ob)
 
 ;;; test-ob ends here