Sha256: ef361e8b96165866805fb1edf70608b12b616b47a84f8741708d74445fe0b45c

Contents?: true

Size: 805 Bytes

Versions: 92

Compression:

Stored size: 805 Bytes

Contents

require 'puma/io_buffer'
require 'test/unit'

class TestIOBuffer < Test::Unit::TestCase
  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

Version data entries

92 entries across 92 versions & 4 rubygems

Version Path
puma-2.9.0 test/test_iobuffer.rb
rsense-server-0.5.17 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.16 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.15 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.14 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.13 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.12 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.11 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.10 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.9 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.8 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.7 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.6 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.5 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.4 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.2 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
rsense-server-0.5.0 vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb
puma-2.8.2-java test/test_iobuffer.rb
puma-2.8.2 test/test_iobuffer.rb
puma-2.8.1-java test/test_iobuffer.rb