[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/smartparens 623e89e 2/2: test: add rst tests
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/smartparens 623e89e 2/2: test: add rst tests |
Date: |
Sat, 4 Sep 2021 09:57:38 -0400 (EDT) |
branch: elpa/smartparens
commit 623e89ef03dac1b699eca37f480687865099b074
Author: Matus Goljer <matus.goljer@gmail.com>
Commit: Matus Goljer <matus.goljer@gmail.com>
test: add rst tests
---
test/smartparens-rst-test.el | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/test/smartparens-rst-test.el b/test/smartparens-rst-test.el
new file mode 100644
index 0000000..7835c43
--- /dev/null
+++ b/test/smartparens-rst-test.el
@@ -0,0 +1,38 @@
+(require 'smartparens-rst)
+(require 'rst)
+
+(ert-deftest sp-test-rst-insert-quote-dont-escape-quote nil
+ "In text modes where ' and \" are not string syntax, do not
+escape them on the top level."
+ (let ((sp-pairs
+ '((t
+ (:open "\"" :close "\""
+ :actions (insert wrap autoskip navigate)
+ :post-handlers (sp-escape-quotes-after-insert))
+ (:open "[" :close "]" :actions (insert wrap autoskip navigate))))))
+ (sp-test-with-temp-buffer "foo | bar"
+ (rst-mode)
+ (execute-kbd-macro "\"")
+ (sp-buffer-equals "foo \"|\" bar"))))
+
+(ert-deftest sp-test-rst-insert-quote-dont-escape-in-contraction nil
+ "Do not escape ' after a word when it is used as a contraction"
+ (let ((sp-pairs
+ '((t
+ (:open "'" :close "'"
+ :actions (insert wrap autoskip navigate escape)
+ :unless (sp-in-string-quotes-p sp-point-after-word-p)
+ :post-handlers (sp-escape-wrapped-region
sp-escape-quotes-after-insert))
+ (:open "[" :close "]" :actions (insert wrap autoskip navigate))))))
+ (sp-test-with-temp-buffer "foo| bar"
+ (rst-mode)
+ (execute-kbd-macro "'s")
+ (sp-buffer-equals "foo's| bar"))))
+
+(ert-deftest sp-test-rst-no-double-underscore-after-ref nil
+ "When turning the backtick reference to a link by appending an
+underscore, do not double the underscore automatically."
+ (sp-test-with-temp-buffer "foo `bar`|"
+ (rst-mode)
+ (execute-kbd-macro "_")
+ (sp-buffer-equals "foo `bar`_|")))