Sha256: e7f300b45e5a6989946cf7109fe7a989e478decccaab6fe0351f156fee95b661

Contents?: true

Size: 631 Bytes

Versions: 7

Compression:

Stored size: 631 Bytes

Contents

#!/usr/bin/env ruby

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

describe BinData::Rest do
  let(:obj) { BinData::Rest.new }

  it "initial state" do
    obj.must_equal ""
  end

  it "reads till end of stream" do
    data = "abcdefghij"
    obj.read(data).must_equal data
  end

  it "allows setting value for completeness" do
    obj.assign("123")
    obj.must_equal "123"
    obj.to_binary_s.must_equal "123"
  end

  it "accepts BinData::BasePrimitive parameters" do
    rest = BinData::Rest.new(:assert => "abc")
    lambda {
      rest.read("xyz")
    }.must_raise BinData::ValidityError
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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