singleline rescue should not change indentation.
This commit is contained in:
parent
f117fded1c
commit
4156c4498c
|
@ -225,6 +225,8 @@ class Pry
|
|||
|
||||
seen_for_at << add_after if OPTIONAL_DO_TOKENS.include?(token)
|
||||
|
||||
next if is_singleline_if
|
||||
|
||||
if kind == :delimiter
|
||||
track_delimiter(token)
|
||||
elsif OPEN_TOKENS.keys.include?(token) && !is_optional_do && !is_singleline_if
|
||||
|
|
|
@ -243,6 +243,16 @@ OUTPUT
|
|||
expect(@indent.indent(input)).to eq output
|
||||
end
|
||||
|
||||
it "should not indent single-line rescue" do
|
||||
input = <<INPUT.strip
|
||||
def test
|
||||
puts "something" rescue "whatever"
|
||||
end
|
||||
INPUT
|
||||
|
||||
expect(@indent.indent(input)).to eq input
|
||||
end
|
||||
|
||||
it "should not indent inside strings" do
|
||||
expect(@indent.indent(%(def a\n"foo\nbar"\n end))).to eq %(def a\n "foo\nbar"\nend)
|
||||
expect(@indent.indent(%(def a\nputs %w(foo\nbar), 'foo\nbar'\n end))).to eq %(def a\n puts %w(foo\nbar), 'foo\nbar'\nend)
|
||||
|
|
Loading…
Reference in New Issue