1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-28 00:01:33 -08:00

* lisp/progmodes/ruby-mode.el (ruby-parse-partial): Don't increase

depth for unfinished percent literal.  Not using it in the caller.
(ruby-move-to-block): Jump over multiline literals of all types,
ignoring code-looking contents inside them.

* test/automated/ruby-mode-tests.el
(ruby-move-to-block-skips-percent-literal): Add depth-affecting
bits inside the examples.
(ruby-move-to-block-skips-heredoc): New test.
This commit is contained in:
Dmitry Gutov 2013-02-14 07:33:55 +04:00
parent 6b26f14f78
commit 53ca88c478
4 changed files with 41 additions and 10 deletions

View file

@ -449,20 +449,37 @@ VALUES-PLIST is a list with alternating index and value elements."
(dolist (s (list (ruby-test-string
"foo do
| a = %%w(
| def yaa
| )
|end")
(ruby-test-string
"foo do
| a = %%w|
| end
| |
|end")))
(ruby-with-temp-buffer s
(goto-line 1)
(ruby-end-of-block)
(should (= 4 (line-number-at-pos)))
(should (= 5 (line-number-at-pos)))
(ruby-beginning-of-block)
(should (= 1 (line-number-at-pos))))))
(ert-deftest ruby-move-to-block-skips-heredoc ()
(ruby-with-temp-buffer
(ruby-test-string
"if something_wrong?
| ActiveSupport::Deprecation.warn(<<-eowarn)
| boo hoo
| end
| eowarn
|end")
(goto-line 1)
(ruby-end-of-block)
(should (= 6 (line-number-at-pos)))
(ruby-beginning-of-block)
(should (= 1 (line-number-at-pos)))))
(provide 'ruby-mode-tests)
;;; ruby-mode-tests.el ends here