mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
b3f84b4a5b
commit
43c648c832
2 changed files with 18 additions and 2 deletions
|
|
@ -398,7 +398,7 @@ class RubyLex
|
|||
next
|
||||
end
|
||||
case t[1]
|
||||
when :on_lbracket, :on_lbrace, :on_lparen
|
||||
when :on_lbracket, :on_lbrace, :on_lparen, :on_tlambeg
|
||||
depth_difference += 1
|
||||
open_brace_on_line += 1
|
||||
when :on_rbracket, :on_rbrace, :on_rparen
|
||||
|
|
@ -481,7 +481,7 @@ class RubyLex
|
|||
next
|
||||
end
|
||||
case t[1]
|
||||
when :on_lbracket, :on_lbrace, :on_lparen
|
||||
when :on_lbracket, :on_lbrace, :on_lparen, :on_tlambeg
|
||||
spaces_of_nest.push(spaces_at_line_head + open_brace_on_line * 2)
|
||||
open_brace_on_line += 1
|
||||
when :on_rbracket, :on_rbrace, :on_rparen
|
||||
|
|
|
|||
|
|
@ -234,5 +234,21 @@ module TestIRB
|
|||
assert_indenting(lines, row.new_line_spaces, true)
|
||||
end
|
||||
end
|
||||
|
||||
def test_tlambda
|
||||
input_with_correct_indents = [
|
||||
Row.new(%q(if true), nil, 2),
|
||||
Row.new(%q( -> {), nil, 4),
|
||||
Row.new(%q( }), 2, 2),
|
||||
Row.new(%q(end), 0, 0),
|
||||
]
|
||||
|
||||
lines = []
|
||||
input_with_correct_indents.each do |row|
|
||||
lines << row.content
|
||||
assert_indenting(lines, row.current_line_spaces, false)
|
||||
assert_indenting(lines, row.new_line_spaces, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue