Fix Performance/FixedSize cop.

This commit is contained in:
Robert Haines 2021-05-24 21:59:26 +01:00
parent ed21f9cf17
commit 7af12ca887
2 changed files with 8 additions and 11 deletions

View File

@ -51,11 +51,6 @@ Naming/AccessorMethodName:
- 'lib/zip/input_stream.rb'
- 'lib/zip/streamable_stream.rb'
# Offense count: 2
Performance/FixedSize:
Exclude:
- 'test/ioextras/abstract_output_stream_test.rb'
# Offense count: 2
# Cop supports --auto-correct.
Performance/RegexpMatch:

View File

@ -32,13 +32,15 @@ class AbstractOutputStreamTest < MiniTest::Test
end
def test_write
count = @output_stream.write('a little string')
assert_equal('a little string', @output_stream.buffer)
assert_equal('a little string'.length, count)
str1 = 'a little string'
count = @output_stream.write(str1)
assert_equal(str1, @output_stream.buffer)
assert_equal(str1.length, count)
count = @output_stream.write('. a little more')
assert_equal('a little string. a little more', @output_stream.buffer)
assert_equal('. a little more'.length, count)
str2 = '. a little more'
count = @output_stream.write(str2)
assert_equal(str1 + str2, @output_stream.buffer)
assert_equal(str2.length, count)
end
def test_print