summaryrefslogtreecommitdiff
path: root/test/manual/indent/ruby.rb
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-03-22 11:01:30 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-03-22 11:01:30 -0700
commit37b9099068c10383e959ee366a52a22516846163 (patch)
treef135528cdacc4313be84f7bf1ceade19327d5fe7 /test/manual/indent/ruby.rb
parent6bd1e2203486ace170f5de15cf7d66146fc8cc87 (diff)
parent56df61712ac446d3dcd9c897f687cc74a04be314 (diff)
downloademacs-37b9099068c10383e959ee366a52a22516846163.tar.gz
emacs-37b9099068c10383e959ee366a52a22516846163.tar.bz2
emacs-37b9099068c10383e959ee366a52a22516846163.zip
-
Diffstat (limited to 'test/manual/indent/ruby.rb')
-rw-r--r--test/manual/indent/ruby.rb56
1 files changed, 50 insertions, 6 deletions
diff --git a/test/manual/indent/ruby.rb b/test/manual/indent/ruby.rb
index 585263d02a6..b038512b114 100644
--- a/test/manual/indent/ruby.rb
+++ b/test/manual/indent/ruby.rb
@@ -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)