aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDmitry Gutov2016-03-07 02:58:49 +0200
committerDmitry Gutov2016-03-07 05:07:34 +0200
commit6e63b3e997e1ac2fa9b58f0d2edeca3cd83628f2 (patch)
tree80fe9ca13285f52d56c6c2a677001fe36d5ad884 /test
parent066f3bc3f3d024b2e10ee11e09ae6aaa1003bbda (diff)
downloademacs-6e63b3e997e1ac2fa9b58f0d2edeca3cd83628f2.tar.gz
emacs-6e63b3e997e1ac2fa9b58f0d2edeca3cd83628f2.zip
Guard against nested percent literals
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-percent-literal): Don't check the syntax status. (ruby-syntax-propertize): Check it here. And also guard against being in a larger percent literal. * test/automated/ruby-mode-tests.el (ruby-no-nested-percent-literals): New test.
Diffstat (limited to 'test')
-rw-r--r--test/automated/ruby-mode-tests.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el
index da8d77c5157..7073f7a04e2 100644
--- a/test/automated/ruby-mode-tests.el
+++ b/test/automated/ruby-mode-tests.el
@@ -461,6 +461,14 @@ VALUES-PLIST is a list with alternating index and value elements."
461 (ruby-assert-face "%S{foo}" 4 nil) 461 (ruby-assert-face "%S{foo}" 4 nil)
462 (ruby-assert-face "%R{foo}" 4 nil)) 462 (ruby-assert-face "%R{foo}" 4 nil))
463 463
464(ert-deftest ruby-no-nested-percent-literals ()
465 (ruby-with-temp-buffer "a = %w[b %()]"
466 (syntax-propertize (point))
467 (should (null (nth 8 (syntax-ppss))))
468 (should (eq t (nth 3 (syntax-ppss (1- (point-max))))))
469 (search-backward "[")
470 (should (eq t (nth 3 (syntax-ppss))))))
471
464(ert-deftest ruby-add-log-current-method-examples () 472(ert-deftest ruby-add-log-current-method-examples ()
465 (let ((pairs '(("foo" . "#foo") 473 (let ((pairs '(("foo" . "#foo")
466 ("C.foo" . ".foo") 474 ("C.foo" . ".foo")