diff options
| author | Dmitry Gutov | 2012-08-14 08:38:11 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-08-14 08:38:11 -0400 |
| commit | f063063a8a8bfc1ba343e7e9eb5d17f866f6fccd (patch) | |
| tree | 2c68a80c0f9f14d93250ad8f5b4619eae3870f31 /test | |
| parent | e636fafe20f0238d0aaabc4b822642efe68cad9b (diff) | |
| download | emacs-f063063a8a8bfc1ba343e7e9eb5d17f866f6fccd.tar.gz emacs-f063063a8a8bfc1ba343e7e9eb5d17f866f6fccd.zip | |
* 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 @@ | |||
| 1 | 2012-08-14 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * indent/ruby.rb: Rearrange examples, add new ones. | ||
| 4 | |||
| 1 | 2012-08-12 Dmitry Gutov <dgutov@yandex.ru> | 5 | 2012-08-12 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 6 | ||
| 3 | * automated/ruby-mode-tests.el (ruby-move-to-block-stops-at-opening) | 7 | * 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 @@ | |||
| 1 | # Don't mis-match "sub" at the end of words. | 1 | # Percent literals. |
| 2 | a = asub / aslb + bsub / bslb; | ||
| 3 | |||
| 4 | b = %Q{This is a "string"} | 2 | b = %Q{This is a "string"} |
| 5 | c = %w(foo | 3 | c = %w!foo |
| 6 | bar | 4 | bar |
| 7 | baz) | 5 | baz! |
| 8 | d = %!hello! | 6 | d = %(hello (nested) world) |
| 7 | |||
| 8 | # Don't propertize percent literals inside strings. | ||
| 9 | "(%s, %s)" % [123, 456] | ||
| 10 | |||
| 11 | # Or inside comments. | ||
| 12 | x = # "tot %q/to"; = | ||
| 13 | y = 2 / 3 | ||
| 14 | |||
| 15 | # Regexp after whitelisted method. | ||
| 16 | "abc".sub /b/, 'd' | ||
| 17 | |||
| 18 | # Don't mis-match "sub" at the end of words. | ||
| 19 | a = asub / aslb + bsub / bslb; | ||
| 9 | 20 | ||
| 10 | # A "do" after a slash means that slash is not a division, but it doesn't imply | 21 | # Highlight the regexp after "if". |
| 11 | # it's a regexp-ender, since it can be a regexp-starter instead! | 22 | x = toto / foo if /do bar/ =~ "dobar" |
| 12 | x = toto / foo; if /do bar/ then | ||
| 13 | toto = 1 | ||
| 14 | end | ||
| 15 | 23 | ||
| 16 | # Some Cucumber code: | 24 | # Some Cucumber code: |
| 17 | Given /toto/ do | 25 | Given /toto/ do |