diff options
| author | Sriram Thaiyar | 2016-06-22 09:21:26 -0700 |
|---|---|---|
| committer | Dmitry Gutov | 2016-06-27 07:31:39 +0300 |
| commit | 7f02dedfcae6ba0e3a646c1367c908af9b3dbe1d (patch) | |
| tree | 1d2880f718e78d7170655a9eae65bdff08eea36c /test | |
| parent | dd98ee8992c3246861e44447ffcd02886a52878e (diff) | |
| download | emacs-7f02dedfcae6ba0e3a646c1367c908af9b3dbe1d.tar.gz emacs-7f02dedfcae6ba0e3a646c1367c908af9b3dbe1d.zip | |
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 52126a3bdf1..5dd34f8ee41 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." | |||
| 716 | (ruby-backward-sexp) | 716 | (ruby-backward-sexp) |
| 717 | (should (= 2 (line-number-at-pos))))) | 717 | (should (= 2 (line-number-at-pos))))) |
| 718 | 718 | ||
| 719 | (ert-deftest ruby-toggle-string-quotes-quotes-correctly () | ||
| 720 | (let ((pairs | ||
| 721 | '(("puts 'foo\"\\''" . "puts \"foo\\\"'\"") | ||
| 722 | ("puts \"foo'\\\"\"" . "puts 'foo\\'\"'")))) | ||
| 723 | (dolist (pair pairs) | ||
| 724 | (ruby-with-temp-buffer (car pair) | ||
| 725 | (beginning-of-line) | ||
| 726 | (search-forward "foo") | ||
| 727 | (ruby-toggle-string-quotes) | ||
| 728 | (should (string= (buffer-string) (cdr pair))))))) | ||
| 729 | |||
| 719 | (ert-deftest ruby--insert-coding-comment-ruby-style () | 730 | (ert-deftest ruby--insert-coding-comment-ruby-style () |
| 720 | (with-temp-buffer | 731 | (with-temp-buffer |
| 721 | (let ((ruby-encoding-magic-comment-style 'ruby)) | 732 | (let ((ruby-encoding-magic-comment-style 'ruby)) |