Sha256: 8e9c7d2e288812234a5cc9f2517d01b891ca71909e550e26b6affd8747165afd
Contents?: true
Size: 1010 Bytes
Versions: 4
Compression:
Stored size: 1010 Bytes
Contents
#!/usr/bin/env ruby require File.expand_path(File.join(File.dirname(__FILE__), "common")) describe BinData::Virtual do let(:stream) { StringIO.new "abcdefghij" } it "must not read from any stream" do BinData::Virtual.read(stream) stream.pos.must_equal 0 end it "must not write to a stream" do obj = BinData::Virtual.new obj.to_binary_s.must_equal "" end it "occupies no space" do obj = BinData::Virtual.new obj.num_bytes.must_equal 0 end it "asserts on #read" do data = [] obj = BinData::Virtual.new(:assert => lambda { data << 1; true }) obj.read "" data.must_equal [1] end it "asserts on #assign" do data = [] obj = BinData::Virtual.new(:assert => lambda { data << 1; true }) obj.assign("foo") data.must_equal [1] end it "assigns a value" do obj = BinData::Virtual.new(3) obj.must_equal 3 end it "accepts the :value parameter" do obj = BinData::Virtual.new(:value => 3) obj.must_equal 3 end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
bindata-2.1.0 | test/virtual_test.rb |
bindata-1.8.3 | test/virtual_test.rb |
bindata-2.0.0 | test/virtual_test.rb |
bindata-1.8.2 | test/virtual_test.rb |