diff options
author | Sriram Thaiyar <sriram.thaiyar@gmail.com> | 2016-06-22 09:21:26 -0700 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2016-06-27 07:31:39 +0300 |
commit | 7f02dedfcae6ba0e3a646c1367c908af9b3dbe1d (patch) | |
tree | 1d2880f718e78d7170655a9eae65bdff08eea36c /test | |
parent | dd98ee8992c3246861e44447ffcd02886a52878e (diff) |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/lisp/progmodes/ruby-mode-tests.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lisp/progmodes/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el index 52126a3bdf..5dd34f8ee4 100644 --- a/test/lisp/progmodes/ruby-mode-tests.el +++ b/test/lisp/progmodes/ruby-mode-tests.el @@ -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)) |