diff options
| author | Dmitry Gutov | 2023-12-09 19:04:55 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2023-12-09 19:04:55 +0200 |
| commit | 91f2ade57bb72e9bb4a44da44e5dc69adb3c7584 (patch) | |
| tree | fed4bf06cedd388dc2df6de198b9f2018d9be5d6 /test | |
| parent | 0f361cc985d35202556233f04235df1c885f532e (diff) | |
| download | emacs-91f2ade57bb72e9bb4a44da44e5dc69adb3c7584.tar.gz emacs-91f2ade57bb72e9bb4a44da44e5dc69adb3c7584.zip | |
ruby-mode: Better detect regexp vs division (bug#67569)
* lisp/progmodes/ruby-mode.el (ruby-syntax-before-regexp-re):
Add grouping around methods from the whitelist.
(ruby-syntax-propertize): Also look for spaces around the slash.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/progmodes/ruby-mode-tests.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/progmodes/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el index 117385ea3e8..a931541ba35 100644 --- a/test/lisp/progmodes/ruby-mode-tests.el +++ b/test/lisp/progmodes/ruby-mode-tests.el | |||
| @@ -157,6 +157,18 @@ VALUES-PLIST is a list with alternating index and value elements." | |||
| 157 | (ert-deftest ruby-regexp-is-not-mistaken-for-slash-symbol () | 157 | (ert-deftest ruby-regexp-is-not-mistaken-for-slash-symbol () |
| 158 | (ruby-assert-state "x = /foo:/" 3 nil)) | 158 | (ruby-assert-state "x = /foo:/" 3 nil)) |
| 159 | 159 | ||
| 160 | (ert-deftest ruby-slash-not-regexp-when-surrounded-by-spaces () | ||
| 161 | (ruby-assert-state "x = index / 3" 3 nil)) | ||
| 162 | |||
| 163 | (ert-deftest ruby-slash-not-regexp-when-no-spaces () | ||
| 164 | (ruby-assert-state "x = index/3" 3 nil)) | ||
| 165 | |||
| 166 | (ert-deftest ruby-regexp-not-division-when-only-space-before () | ||
| 167 | (ruby-assert-state "x = index /3" 3 ?/)) | ||
| 168 | |||
| 169 | (ert-deftest ruby-slash-not-regexp-when-only-space-after () | ||
| 170 | (ruby-assert-state "x = index/ 3" 3 nil)) | ||
| 171 | |||
| 160 | (ert-deftest ruby-indent-simple () | 172 | (ert-deftest ruby-indent-simple () |
| 161 | (ruby-should-indent-buffer | 173 | (ruby-should-indent-buffer |
| 162 | "if foo | 174 | "if foo |