]> code.delx.au - gnu-emacs/blobdiff - test/manual/indent/ruby.rb
Merge from origin/emacs-25
[gnu-emacs] / test / manual / indent / ruby.rb
index 585263d02a6c713ff076079947d21b3f20ae43b4..b038512b114cf0e0d58a0301519590a19ddda9b9 100644 (file)
@@ -24,8 +24,8 @@ d = %(hello (nested) world)
 # Don't propertize percent literals inside strings.
 "(%s, %s)" % [123, 456]
 
-"abc/#{def}ghi"
-"abc\#{def}ghi"
+"abc/#{ddf}ghi"
+"abc\#{ddf}ghi"
 
 # Or inside comments.
 x = # "tot %q/to"; =
@@ -222,7 +222,7 @@ foo.
   bar
 
 # https://github.com/rails/rails/blob/17f5d8e062909f1fcae25351834d8e89967b645e/activesupport/lib/active_support/time_with_zone.rb#L206
-foo
+foo # comment intended to confuse the tokenizer
   .bar
 
 z = {
@@ -295,16 +295,38 @@ foo > bar &&
   tee < qux
 
 zux do
-  foo == bar and
+  foo == bar &&
     tee == qux
+
+  a = 3 and
+    b = 4
 end
 
+foo + bar ==
+  tee + qux
+
+1 .. 2 &&
+     3
+
+3 < 4 +
+    5
+
+10 << 4 ^
+  20
+
+100 + 2 >>
+  3
+
+2 ** 10 /
+  2
+
 foo ^
   bar
 
 foo_bar_tee(1, 2, 3)
-  .qux.bar
-  .tee
+  .qux&.bar
+  .tee.bar
+  &.tee
 
 foo do
   bar
@@ -316,6 +338,11 @@ def bar
     .baz
 end
 
+abc(foo
+      .bar,
+    tee
+      .qux)
+
 # http://stackoverflow.com/questions/17786563/emacs-ruby-mode-if-expressions-indentation
 tee = if foo
         bar
@@ -399,6 +426,17 @@ zoo
 a.records().map(&:b).zip(
   foo)
 
+foo1 =
+  subject.update(
+    1
+  )
+
+foo2 =
+  subject.
+    update(
+      2
+    )
+
 # FIXME: This is not consistent with the example below it, but this
 # offset only happens if the colon is at eol, which wouldn't be often.
 # Tokenizing `bar:' as `:bar =>' would be better, but it's hard to
@@ -409,6 +447,12 @@ foo(bar:
 foo(:bar =>
     tee)
 
+regions = foo(
+  OpenStruct.new(id: 0, name: "foo") => [
+    10
+  ]
+)
+
 {'a' => {
    'b' => 'c',
    'd' => %w(e f)