Skip to content

Commit

Permalink
+ Source::Buffer#inspect [#728] (#787)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed Mar 7, 2021
1 parent 9d5e851 commit b4e903d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/parser/source/buffer.rb
Expand Up @@ -305,6 +305,11 @@ def freeze
super
end

# :nodoc:
def inspect
"#<#{self.class} #{name}>"
end

private

# @returns [0, line_begin_of_line_1, ..., source.size + 1]
Expand Down
4 changes: 4 additions & 0 deletions test/test_source_buffer.rb
Expand Up @@ -179,4 +179,8 @@ def test_ractor
assert ::Ractor.shareable?(@buffer)
assert_equal ':world', @buffer.line_range(2).source
end if defined?(::Ractor)

def test_inspect
assert_equal '#<Parser::Source::Buffer (string)>', @buffer.inspect
end
end

0 comments on commit b4e903d

Please sign in to comment.