aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDmitry Gutov2013-03-06 22:56:29 +0400
committerDmitry Gutov2013-03-06 22:56:29 +0400
commitab89e9f9a594c30ce4c04e6d502bee3beaefe908 (patch)
tree1f41ac1aab95f08ab04f3ffb6210b5156d461e6b /test
parenta611149e46d0a6927e9c276d4cf2089b7cfb7e05 (diff)
downloademacs-ab89e9f9a594c30ce4c04e6d502bee3beaefe908.tar.gz
emacs-ab89e9f9a594c30ce4c04e6d502bee3beaefe908.zip
* 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.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el
index c67f92e6ed9..81bae187218 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."
47(defun ruby-test-string (s &rest args) 47(defun ruby-test-string (s &rest args)
48 (apply 'format (replace-regexp-in-string "^[ \t]*|" "" s) args)) 48 (apply 'format (replace-regexp-in-string "^[ \t]*|" "" s) args))
49 49
50(defun ruby-assert-state (content &rest values-plist) 50(defun ruby-assert-state (content index value &optional point)
51 "Assert syntax state values at the end of CONTENT. 51 "Assert syntax state values at the end of CONTENT.
52 52
53VALUES-PLIST is a list with alternating index and value elements." 53VALUES-PLIST is a list with alternating index and value elements."
54 (ruby-with-temp-buffer content 54 (ruby-with-temp-buffer content
55 (when point (goto-char point))
55 (syntax-propertize (point)) 56 (syntax-propertize (point))
56 (while values-plist 57 (should (eq (nth index
57 (should (eq (nth (car values-plist) 58 (parse-partial-sexp (point-min) (point)))
58 (parse-partial-sexp (point-min) (point))) 59 value))))
59 (cadr values-plist)))
60 (setq values-plist (cddr values-plist)))))
61 60
62(defun ruby-assert-face (content pos face) 61(defun ruby-assert-face (content pos face)
63 (ruby-with-temp-buffer content 62 (ruby-with-temp-buffer content
@@ -104,6 +103,12 @@ VALUES-PLIST is a list with alternating index and value elements."
104 (ruby-should-indent "a = %w[abc\n def]\n " 0) 103 (ruby-should-indent "a = %w[abc\n def]\n " 0)
105 (ruby-should-indent "a = \"abc\n def\"\n " 0)) 104 (ruby-should-indent "a = \"abc\n def\"\n " 0))
106 105
106(ert-deftest ruby-regexp-doest-start-in-string ()
107 (ruby-assert-state "'(/', /\d+/" 3 nil))
108
109(ert-deftest ruby-regexp-starts-after-string ()
110 (ruby-assert-state "'(/', /\d+/" 3 ?/ 8))
111
107(ert-deftest ruby-indent-simple () 112(ert-deftest ruby-indent-simple ()
108 (ruby-should-indent-buffer 113 (ruby-should-indent-buffer
109 "if foo 114 "if foo