summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <eric.schulte@gmx.com>2012-01-30 08:51:17 -0700
committerEric Schulte <eric.schulte@gmx.com>2012-01-30 08:51:17 -0700
commit660e30b39c021ab7d1003d79f2e0debe1cba450c (patch)
treeda460b74eb83b86ab1bd0f4ff09c1fd00e3d17a8
parent843ac278f911e0a017356d570a4f31ded172fe49 (diff)
downloadorg-mode-660e30b39c021ab7d1003d79f2e0debe1cba450c.tar.gz
inline src block tests by Martyn Jago
* testing/lisp/test-ob.el (test-org-babel/inline-src_blk-preceded-punct): Inline src block tests by Martyn Jago.
-rw-r--r--testing/lisp/test-ob.el69
1 files changed, 69 insertions, 0 deletions
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index c819fac..e7e1eea 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -588,6 +588,75 @@ on two lines
(org-babel-balanced-split ":a 1 :b [2 3] :c (4 :d (5 6))"
'((32 9) . 58)))))
+(ert-deftest test-org-babel/inline-src_blk-preceded-punct ()
+ "Test inline source block where preceded by punctuation"
+
+ ;; inline-src-blk 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))))))
+
+ ;; inline-src-blk 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))))))
+
+ ;; inline-src-blk 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))))))
+
+ ;; inline-src-blk 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