Sha256: 15d06e5b0718b66872327c948c49bd3c83d249f12bbc4c12ebcf137828d06279

Contents?: true

Size: 638 Bytes

Versions: 7

Compression:

Stored size: 638 Bytes

Contents

#!/usr/bin/env ruby

require File.expand_path(File.join(File.dirname(__FILE__), "common"))

describe BinData::Skip do
  let(:obj) { BinData::Skip.new(:length => 5) }
  let(:io) { StringIO.new("abcdefghij") }

  it "initial state" do
    obj.must_equal ""
    obj.to_binary_s.must_equal "\000" * 5
  end

  it "skips bytes" do
    obj.read(io)
    io.pos.must_equal 5
  end

  it "has expected binary representation after setting value" do
    obj.assign("123")
    obj.to_binary_s.must_equal "\000" * 5
  end

  it "has expected binary representation after reading" do
    obj.read(io)
    obj.to_binary_s.must_equal "\000" * 5
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bindata-2.1.0 test/skip_test.rb
bindata-1.8.3 test/skip_test.rb
bindata-2.0.0 test/skip_test.rb
bindata-1.8.2 test/skip_test.rb
bindata-1.8.1 test/skip_test.rb
bindata-1.8.0 test/skip_test.rb
bindata-1.6.0 test/skip_test.rb