mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Fix quote escaping in ruby-toggle-string-quotes
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes): Change logic to quote based on the current quote of the string. * test/lisp/progmodes/ruby-mode-tests.el (ruby-toggle-string-quotes-quotes-correctly): Add test. Copyright-paperwork-exempt: yes
This commit is contained in:
parent
dd98ee8992
commit
7f02dedfca
2 changed files with 12 additions and 1 deletions
|
|
@ -716,6 +716,17 @@ VALUES-PLIST is a list with alternating index and value elements."
|
|||
(ruby-backward-sexp)
|
||||
(should (= 2 (line-number-at-pos)))))
|
||||
|
||||
(ert-deftest ruby-toggle-string-quotes-quotes-correctly ()
|
||||
(let ((pairs
|
||||
'(("puts 'foo\"\\''" . "puts \"foo\\\"'\"")
|
||||
("puts \"foo'\\\"\"" . "puts 'foo\\'\"'"))))
|
||||
(dolist (pair pairs)
|
||||
(ruby-with-temp-buffer (car pair)
|
||||
(beginning-of-line)
|
||||
(search-forward "foo")
|
||||
(ruby-toggle-string-quotes)
|
||||
(should (string= (buffer-string) (cdr pair)))))))
|
||||
|
||||
(ert-deftest ruby--insert-coding-comment-ruby-style ()
|
||||
(with-temp-buffer
|
||||
(let ((ruby-encoding-magic-comment-style 'ruby))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue