diff options
| author | Dmitry Gutov | 2014-01-31 19:13:49 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2014-01-31 19:13:49 +0200 |
| commit | e2a67bd08ea194da1b338c69c4da6e539782cb14 (patch) | |
| tree | c559f7d7caf622d491520698926e85387dabb4c5 /test | |
| parent | ec80e689331728b22f34a797ec06354ac4595b4a (diff) | |
| download | emacs-e2a67bd08ea194da1b338c69c4da6e539782cb14.tar.gz emacs-e2a67bd08ea194da1b338c69c4da6e539782cb14.zip | |
Implement user option ruby-align-chained-calls
* lisp/progmodes/ruby-mode.el (ruby-align-chained-calls): New option.
(ruby-smie-grammar): Make "." right-associative. Make its priority
lower than the ternary and all binary operators.
(ruby-smie-rules): Indent "(" relative to the first non-"."
parent, or the first "." parent at indentation. Use
`ruby-align-chained-calls' for indentation of "." tokens.
* test/automated/ruby-mode-tests.el (ruby-align-chained-calls):
New test.
Fixes: debbugs:16593
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 5 | ||||
| -rw-r--r-- | test/automated/ruby-mode-tests.el | 14 | ||||
| -rw-r--r-- | test/indent/ruby.rb | 8 |
3 files changed, 23 insertions, 4 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 50ffd7c3957..5afc9890aff 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-01-31 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * automated/ruby-mode-tests.el (ruby-align-chained-calls): | ||
| 4 | New test. | ||
| 5 | |||
| 1 | 2014-01-27 Michael Albinus <michael.albinus@gmx.de> | 6 | 2014-01-27 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 7 | ||
| 3 | * automated/file-notify-tests.el (file-notify--deftest-remote): | 8 | * automated/file-notify-tests.el (file-notify--deftest-remote): |
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index aa8032bb870..f6fddb5ef4c 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el | |||
| @@ -333,6 +333,20 @@ VALUES-PLIST is a list with alternating index and value elements." | |||
| 333 | | 42 | 333 | | 42 |
| 334 | | end"))) | 334 | | end"))) |
| 335 | 335 | ||
| 336 | (ert-deftest ruby-align-chained-calls () | ||
| 337 | (let ((ruby-align-chained-calls t)) | ||
| 338 | (ruby-should-indent-buffer | ||
| 339 | "one.two.three | ||
| 340 | | .four | ||
| 341 | | | ||
| 342 | |my_array.select { |str| str.size > 5 } | ||
| 343 | | .map { |str| str.downcase }" | ||
| 344 | "one.two.three | ||
| 345 | | .four | ||
| 346 | | | ||
| 347 | |my_array.select { |str| str.size > 5 } | ||
| 348 | | .map { |str| str.downcase }"))) | ||
| 349 | |||
| 336 | (ert-deftest ruby-move-to-block-stops-at-indentation () | 350 | (ert-deftest ruby-move-to-block-stops-at-indentation () |
| 337 | (ruby-with-temp-buffer "def f\nend" | 351 | (ruby-with-temp-buffer "def f\nend" |
| 338 | (beginning-of-line) | 352 | (beginning-of-line) |
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index a0116fef18e..49ed92f8fdc 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb | |||
| @@ -257,8 +257,8 @@ foo ^ | |||
| 257 | bar | 257 | bar |
| 258 | 258 | ||
| 259 | foo_bar_tee(1, 2, 3) | 259 | foo_bar_tee(1, 2, 3) |
| 260 | .qux | 260 | .qux.bar |
| 261 | .bar | 261 | .tee |
| 262 | 262 | ||
| 263 | foo do | 263 | foo do |
| 264 | bar | 264 | bar |
| @@ -338,7 +338,7 @@ end | |||
| 338 | %^abc^ | 338 | %^abc^ |
| 339 | ddd | 339 | ddd |
| 340 | 340 | ||
| 341 | qux = foo ? | 341 | qux = foo.fee ? |
| 342 | bar : | 342 | bar : |
| 343 | tee | 343 | tee |
| 344 | 344 | ||
| @@ -348,7 +348,7 @@ zoo.keep.bar!( | |||
| 348 | 348 | ||
| 349 | zoo | 349 | zoo |
| 350 | .lose( | 350 | .lose( |
| 351 | q, p) | 351 | q, p) |
| 352 | 352 | ||
| 353 | foo(bar: | 353 | foo(bar: |
| 354 | tee) | 354 | tee) |