Skip to content

Commit c382a02

Browse files
committed
Add embdoc indent test
1 parent 2b46a87 commit c382a02

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/irb/test_ruby_lex.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,29 @@ def test_local_variables_dependent_code
577577
assert_code_block_open(lines, false, local_variables: ['a'])
578578
end
579579

580+
def test_embdoc_indent
581+
input_with_correct_indents = [
582+
Row.new(%q(=begin), 0, 0, 0),
583+
Row.new(%q(a), 0, 0, 0),
584+
Row.new(%q( b), 1, 1, 0),
585+
Row.new(%q(=end), 0, 0, 0),
586+
Row.new(%q(if 1), 0, 2, 1),
587+
Row.new(%q( 2), 2, 2, 1),
588+
Row.new(%q(=begin), 0, 0, 1),
589+
Row.new(%q(a), 0, 0, 1),
590+
Row.new(%q( b), 1, 1, 1),
591+
Row.new(%q(=end), 0, 2, 1),
592+
Row.new(%q( 3), 2, 2, 1),
593+
Row.new(%q(end), 0, 0, 0),
594+
]
595+
lines = []
596+
input_with_correct_indents.each do |row|
597+
lines << row.content
598+
assert_row_indenting(lines, row)
599+
assert_nesting_level(lines, row.nesting_level)
600+
end
601+
end
602+
580603
def test_heredoc_with_indent
581604
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7.0')
582605
pend 'This test needs Ripper::Lexer#scan to take broken tokens'

0 commit comments

Comments
 (0)