Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/irb/nesting_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def heredoc_string_like(node, type)
# Heredoc closing contains trailing newline. We need to exclude it
close_location_start(node.closing_loc) if node.closing_loc && !node.closing.empty?
elsif node.opening
return if node.opening == '?' && node.closing.nil? # Character literal has no closing
open_location(node.location, type, node.opening)
if node.closing && node.closing != ''
# Closing of `"#{\n` is "\n". We need to treat it as not-closed.
Expand Down
10 changes: 10 additions & 0 deletions test/irb/test_nesting_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,5 +347,15 @@ def test_case_in
assert_equal(['in'], next_opens.map(&:tok))
end
end

def test_char_literal
code = <<~EOS
?a
EOS
prev_opens, next_opens, min_depth = parse_by_line(code).last
assert_equal([], prev_opens)
assert_equal([], next_opens)
assert_equal(0, min_depth)
end
end
end