summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-02-11 02:11:35 +0900
committeraycabta <aycabta@gmail.com>2020-02-12 13:14:28 +0900
commit8b8cc01229c2849236e7b43e1b5b5d33ccfb6b1e (patch)
tree83164baf13cf585fbe419e2ff5e0569c232fa33f /test
parent0719e1be11f4e3411b78f5e1d4de553f30f29bb0 (diff)
[ruby/irb] Fix auto indent with closed brace
A closed brace in auto-indent shouldn't affect the next brace in the same line, but it behaves like below: p() { } It's a bug. https://github.com/ruby/irb/commit/fbe59e344f
Diffstat (limited to 'test')
-rw-r--r--test/irb/test_ruby_lex.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/irb/test_ruby_lex.rb b/test/irb/test_ruby_lex.rb
index 65fc7d431a..886891c4a7 100644
--- a/test/irb/test_ruby_lex.rb
+++ b/test/irb/test_ruby_lex.rb
@@ -112,5 +112,19 @@ module TestIRB
assert_indenting(lines, row.new_line_spaces, true)
end
end
+
+ def test_a_closed_brace_and_not_closed_brace_in_a_line
+ input_with_correct_indents = [
+ Row.new(%q(p() {), nil, 2),
+ Row.new(%q(}), 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