Sha256: 70afbe653c545cd5e9553a4d364280708970da6c9fc1a5d72adcc54950aad018

Contents?: true

Size: 829 Bytes

Versions: 4

Compression:

Stored size: 829 Bytes

Contents

#!/usr/bin/env ruby

require File.expand_path(File.join(File.dirname(__FILE__), "spec_common"))
require 'bindata/skip'

describe BinData::Skip do
  before(:each) do
    @skip = BinData::Skip.new(:length => 5)
  end

  it "should default to the empty string" do
    @skip.should == ""
  end

  it "should skip bytes" do
    io = StringIO.new("abcdefghij")
    @skip.read(io)
    io.pos.should == 5
  end

  it "should have expected binary representation" do
    @skip.to_binary_s.should == "\000" * 5
  end

  it "should have expected binary representation after setting value" do
    @skip.value = "123"
    @skip.to_binary_s.should == "\000" * 5
  end

  it "should have expected binary representation after reading" do
    io = StringIO.new("abcdefghij")
    @skip.read(io)
    @skip.to_binary_s.should == "\000" * 5
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bindata-1.2.2 spec/skip_spec.rb
bindata-1.2.1 spec/skip_spec.rb
bindata-1.2.0 spec/skip_spec.rb
bindata-1.1.0 spec/skip_spec.rb