diff options
author | Dmitry Gutov <[email protected]> | 2013-03-06 22:56:29 +0400 |
---|---|---|
committer | Dmitry Gutov <[email protected]> | 2013-03-06 22:56:29 +0400 |
commit | ab89e9f9a594c30ce4c04e6d502bee3beaefe908 (patch) | |
tree | 1f41ac1aab95f08ab04f3ffb6210b5156d461e6b /test | |
parent | a611149e46d0a6927e9c276d4cf2089b7cfb7e05 (diff) |
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only
propertize regexp when not inside a string.
Fixes: debbugs:13885
Diffstat (limited to 'test')
-rw-r--r-- | test/automated/ruby-mode-tests.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index c67f92e6ed..81bae18721 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el @@ -47,17 +47,16 @@ The whitespace before and including \"|\" on each line is removed." (defun ruby-test-string (s &rest args) (apply 'format (replace-regexp-in-string "^[ \t]*|" "" s) args)) -(defun ruby-assert-state (content &rest values-plist) +(defun ruby-assert-state (content index value &optional point) "Assert syntax state values at the end of CONTENT. VALUES-PLIST is a list with alternating index and value elements." (ruby-with-temp-buffer content + (when point (goto-char point)) (syntax-propertize (point)) - (while values-plist - (should (eq (nth (car values-plist) - (parse-partial-sexp (point-min) (point))) - (cadr values-plist))) - (setq values-plist (cddr values-plist))))) + (should (eq (nth index + (parse-partial-sexp (point-min) (point))) + value)))) (defun ruby-assert-face (content pos face) (ruby-with-temp-buffer content @@ -104,6 +103,12 @@ VALUES-PLIST is a list with alternating index and value elements." (ruby-should-indent "a = %w[abc\n def]\n " 0) (ruby-should-indent "a = \"abc\n def\"\n " 0)) +(ert-deftest ruby-regexp-doest-start-in-string () + (ruby-assert-state "'(/', /\d+/" 3 nil)) + +(ert-deftest ruby-regexp-starts-after-string () + (ruby-assert-state "'(/', /\d+/" 3 ?/ 8)) + (ert-deftest ruby-indent-simple () (ruby-should-indent-buffer "if foo |