diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2012-08-14 08:38:11 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-08-14 08:38:11 -0400 |
commit | f063063a8a8bfc1ba343e7e9eb5d17f866f6fccd (patch) | |
tree | 2c68a80c0f9f14d93250ad8f5b4619eae3870f31 /test | |
parent | e636fafe20f0238d0aaabc4b822642efe68cad9b (diff) | |
download | emacs-f063063a8a8bfc1ba343e7e9eb5d17f866f6fccd.tar.gz |
* lisp/progmodes/ruby-mode.el (ruby-syntax-methods-before-regexp): New const.
(ruby-syntax-propertize-function): Use it to recognize regexps.
Don't look at the text after regexp, just use the whitelist.
* test/indent/ruby.rb: Rearrange examples, add new ones.
Fixes: debbugs:6286
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 4 | ||||
-rw-r--r-- | test/indent/ruby.rb | 30 |
2 files changed, 23 insertions, 11 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index a0163b56e6d..f1bf458f812 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2012-08-14 Dmitry Gutov <dgutov@yandex.ru> + + * indent/ruby.rb: Rearrange examples, add new ones. + 2012-08-12 Dmitry Gutov <dgutov@yandex.ru> * automated/ruby-mode-tests.el (ruby-move-to-block-stops-at-opening) diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index c4a747a1c78..4f2e9e63377 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb @@ -1,17 +1,25 @@ -# Don't mis-match "sub" at the end of words. -a = asub / aslb + bsub / bslb; - +# Percent literals. b = %Q{This is a "string"} -c = %w(foo +c = %w!foo bar - baz) -d = %!hello! + baz! +d = %(hello (nested) world) + +# Don't propertize percent literals inside strings. +"(%s, %s)" % [123, 456] + +# Or inside comments. +x = # "tot %q/to"; = +y = 2 / 3 + +# Regexp after whitelisted method. +"abc".sub /b/, 'd' + +# Don't mis-match "sub" at the end of words. +a = asub / aslb + bsub / bslb; -# A "do" after a slash means that slash is not a division, but it doesn't imply -# it's a regexp-ender, since it can be a regexp-starter instead! -x = toto / foo; if /do bar/ then - toto = 1 - end +# Highlight the regexp after "if". +x = toto / foo if /do bar/ =~ "dobar" # Some Cucumber code: Given /toto/ do |