aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/progmodes/ruby-mode-resources/ruby.rb
diff options
context:
space:
mode:
authorDmitry Gutov2022-12-30 23:58:26 +0200
committerDmitry Gutov2022-12-31 00:00:21 +0200
commit8675f4136c7da7356e5578cf1eabda2f37a597e5 (patch)
treef37bbb61f80912e30f2428c20b16c30c8e7ab2bc /test/lisp/progmodes/ruby-mode-resources/ruby.rb
parent4922de626f05f0c26bc732b082c30c5c18a88416 (diff)
downloademacs-8675f4136c7da7356e5578cf1eabda2f37a597e5.tar.gz
emacs-8675f4136c7da7356e5578cf1eabda2f37a597e5.zip
Add new options for Ruby code indentation
* lisp/progmodes/ruby-mode.el (ruby-block-indent) (ruby-after-operator-indent, ruby-method-call-indent) (ruby-parenless-call-arguments-indent): New options (bug#60186). (ruby-smie-grammar): Specify associativity for "?". (ruby-smie--indent-to-stmt): Add optional argument. * test/lisp/progmodes/ruby-mode-resources/ruby.rb: New cases. * test/lisp/progmodes/ruby-mode-resources/ruby-method-call-indent.rb: * test/lisp/progmodes/ruby-mode-resources/ruby-block-indent.rb: * test/lisp/progmodes/ruby-mode-resources/ruby-after-operator-indent.rb: * test/lisp/progmodes/ruby-mode-resources/ ruby-parenless-call-arguments-indent.rb: New files. * test/lisp/progmodes/ruby-mode-tests.el: Add indentation tests for new files.
Diffstat (limited to 'test/lisp/progmodes/ruby-mode-resources/ruby.rb')
-rw-r--r--test/lisp/progmodes/ruby-mode-resources/ruby.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby.rb b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
index 6a69d9db78a..bfae948b259 100644
--- a/test/lisp/progmodes/ruby-mode-resources/ruby.rb
+++ b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
@@ -226,6 +226,7 @@ desc "foo foo" \
226 226
227foo. 227foo.
228 bar 228 bar
229 .baz
229 230
230# https://github.com/rails/rails/blob/17f5d8e062909f1fcae25351834d8e89967b645e/activesupport/lib/active_support/time_with_zone.rb#L206 231# https://github.com/rails/rails/blob/17f5d8e062909f1fcae25351834d8e89967b645e/activesupport/lib/active_support/time_with_zone.rb#L206
231foo # comment intended to confuse the tokenizer 232foo # comment intended to confuse the tokenizer
@@ -380,6 +381,18 @@ foo = [1, 2, 3].map do |i|
380 i + 1 381 i + 1
381end 382end
382 383
384m1 = foo
385 .asdasd
386 .proc do |**args|
387 p(**args)
388end
389
390m2 = foo
391 .asdasd
392 .proc { |**args|
393 p(**args)
394}
395
383bar.foo do 396bar.foo do
384 bar 397 bar
385end 398end
@@ -398,6 +411,12 @@ bar 1 do
398 end 411 end
399end 412end
400 413
414x.foo do
415 foo
416end.bar do
417 bar
418end
419
401foo | 420foo |
402 bar 421 bar
403 422
@@ -540,5 +559,9 @@ class Bar
540end 559end
541 560
542# Local Variables: 561# Local Variables:
562# ruby-after-operator-indent: t
563# ruby-block-indent: t
564# ruby-method-call-indent: t
543# ruby-method-params-indent: t 565# ruby-method-params-indent: t
566# ruby-parenless-call-arguments-indent: t
544# End: 567# End: