mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
9d93a0f62f
running `rake` loads all files starting with `test_` which is not supposed to also load the helper, since the helper should be loaded by each test and is not a test itself.
39 lines
805 B
Ruby
39 lines
805 B
Ruby
require_relative "helper"
|
|
|
|
require "puma/io_buffer"
|
|
|
|
class TestIOBuffer < Minitest::Test
|
|
attr_accessor :iobuf
|
|
def setup
|
|
self.iobuf = Puma::IOBuffer.new
|
|
end
|
|
|
|
def test_initial_size
|
|
assert_equal 0, iobuf.used
|
|
assert iobuf.capacity > 0
|
|
end
|
|
|
|
def test_append_op
|
|
iobuf << "abc"
|
|
assert_equal "abc", iobuf.to_s
|
|
iobuf << "123"
|
|
assert_equal "abc123", iobuf.to_s
|
|
assert_equal 6, iobuf.used
|
|
end
|
|
|
|
def test_append
|
|
expected = "mary had a little lamb"
|
|
iobuf.append("mary", " ", "had ", "a little", " lamb")
|
|
assert_equal expected, iobuf.to_s
|
|
assert_equal expected.length, iobuf.used
|
|
end
|
|
|
|
def test_reset
|
|
iobuf << "content"
|
|
assert_equal "content", iobuf.to_s
|
|
iobuf.reset
|
|
assert_equal 0, iobuf.used
|
|
assert_equal "", iobuf.to_s
|
|
end
|
|
|
|
end
|