aboutsummaryrefslogtreecommitdiffstats
path: root/test/automated/ruby-mode-tests.el
diff options
context:
space:
mode:
authorDmitry Gutov2013-12-20 07:20:33 +0200
committerDmitry Gutov2013-12-20 07:20:33 +0200
commitb520f210b12911b747cd7cd725c310bef4790a48 (patch)
tree77e79dd61f417764f4e32a0baa2c8a35548b35bc /test/automated/ruby-mode-tests.el
parent26b75b456e536c1fb2d3979e07e82455b2d9c1ca (diff)
downloademacs-b520f210b12911b747cd7cd725c310bef4790a48.tar.gz
emacs-b520f210b12911b747cd7cd725c310bef4790a48.zip
* lisp/progmodes/ruby-mode.el (ruby-align-to-stmt-keywords): New
option. (ruby-smie--indent-to-stmt-p): Use it. (ruby-smie-rules): Revert the logic in the handling of `when'. Expand the `begin' clause to handle `ruby-align-to-stmt-keywords'. (ruby-deep-arglist, ruby-deep-indent-paren) (ruby-deep-indent-paren-style): Update docstrings to note that the vars don't have any effect with SMIE. * test/automated/ruby-mode-tests.el: Add tests for `ruby-align-to-stmt-keywords'. * test/indent/ruby.rb: Update examples to reflect the lack of change in default indentation of `begin' blocks. Fixes: debbugs:16182
Diffstat (limited to 'test/automated/ruby-mode-tests.el')
-rw-r--r--test/automated/ruby-mode-tests.el51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el
index 9c121169756..de0c1bb9629 100644
--- a/test/automated/ruby-mode-tests.el
+++ b/test/automated/ruby-mode-tests.el
@@ -282,6 +282,57 @@ VALUES-PLIST is a list with alternating index and value elements."
282 | 3) 282 | 3)
283 |"))) 283 |")))
284 284
285(ert-deftest ruby-align-to-stmt-keywords-t ()
286 (let ((ruby-align-to-stmt-keywords t))
287 (ruby-should-indent-buffer
288 "foo = if bar?
289 | 1
290 |else
291 | 2
292 |end
293 |
294 |foo || begin
295 | bar
296 |end
297 |
298 |foo ||
299 | begin
300 | bar
301 | end
302 |"
303 "foo = if bar?
304 | 1
305 |else
306 | 2
307 | end
308 |
309 | foo || begin
310 | bar
311 |end
312 |
313 | foo ||
314 | begin
315 |bar
316 | end
317 |")
318 ))
319
320(ert-deftest ruby-align-to-stmt-keywords-case ()
321 (let ((ruby-align-to-stmt-keywords '(case)))
322 (ruby-should-indent-buffer
323 "b = case a
324 |when 13
325 | 6
326 |else
327 | 42
328 |end"
329 "b = case a
330 | when 13
331 | 6
332 | else
333 | 42
334 | end")))
335
285(ert-deftest ruby-move-to-block-stops-at-indentation () 336(ert-deftest ruby-move-to-block-stops-at-indentation ()
286 (ruby-with-temp-buffer "def f\nend" 337 (ruby-with-temp-buffer "def f\nend"
287 (beginning-of-line) 338 (beginning-of-line)