aboutsummaryrefslogtreecommitdiffstats
path: root/test
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
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')
-rw-r--r--test/ChangeLog8
-rw-r--r--test/automated/ruby-mode-tests.el51
-rw-r--r--test/indent/ruby.rb37
3 files changed, 75 insertions, 21 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 374cae5a295..cefdd2de9fd 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,11 @@
12013-12-20 Dmitry Gutov <dgutov@yandex.ru>
2
3 * automated/ruby-mode-tests.el: Add tests for
4 `ruby-align-to-stmt-keywords'.
5
6 * indent/ruby.rb: Update examples to reflect the lack of change in
7 default indentation of `begin' blocks.
8
12013-12-17 Dmitry Gutov <dgutov@yandex.ru> 92013-12-17 Dmitry Gutov <dgutov@yandex.ru>
2 10
3 * indent/ruby.rb: Update examples according to the change 11 * indent/ruby.rb: Update examples according to the change
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)
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
index 1993c29efb3..7a1a225834d 100644
--- a/test/indent/ruby.rb
+++ b/test/indent/ruby.rb
@@ -114,17 +114,17 @@ def test2 (arg)
114 puts "there" 114 puts "there"
115 end 115 end
116 116
117 case a 117 b = case a
118 when "a" 118 when "a"
119 6 119 6
120 # Support for this syntax was removed in Ruby 1.9, so we 120 # Support for this syntax was removed in Ruby 1.9, so we
121 # probably don't need to handle it either. 121 # probably don't need to handle it either.
122 # when "b" : 122 # when "b" :
123 # 7 123 # 7
124 # when "c" : 2 124 # when "c" : 2
125 when "d" then 4 125 when "d" then 4
126 else 5 126 else 5
127 end 127 end
128end 128end
129 129
130# Some Cucumber code: 130# Some Cucumber code:
@@ -321,18 +321,13 @@ end
321foo | 321foo |
322 bar 322 bar
323 323
324foo ||
325 begin
326 bar
327 end
328
329def qux 324def qux
330 foo ||= begin 325 foo ||= begin
331 bar 326 bar
332 tee 327 tee
333 rescue 328 rescue
334 oomph 329 oomph
335 end 330 end
336end 331end
337 332
338%^abc^ 333%^abc^