Sha256: 300b2d0867ab26eb087d7d8d49cbe45cd6c2504934e4e9b8ad37e2bd50d31655

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require "spec_helper"

describe MessagePack::Unpacker do
  it "unpacks arrays" do
    bytes = org.msgpack.MessagePack.new.write(["a", "b", "c"])

    subject.feed(bytes)
    subject.first.should == ["a", "b", "c"]
  end

  it "unpacks booleans" do
    bytes = org.msgpack.MessagePack.new.write(true)

    subject.feed(bytes)
    subject.first.should == true
  end

  it "unpacks floats" do
    bytes = org.msgpack.MessagePack.new.write(3.1415)

    subject.feed(bytes)
    subject.first.should == 3.1415
  end

  it "unpacks integers" do
    bytes = org.msgpack.MessagePack.new.write(12345)

    subject.feed(bytes)
    subject.first.should == 12345
  end

  it "unpacks maps" do
    bytes = org.msgpack.MessagePack.new.write("foo" => "bar")

    subject.feed(bytes)
    subject.first.should == {"foo" => "bar"}
  end

  it "unpacks nils" do
    bytes = org.msgpack.MessagePack.new.write(nil)

    subject.feed(bytes)
    subject.first.should == nil
  end

  it "unpacks strings" do
    bytes = org.msgpack.MessagePack.new.write("abc123")

    subject.feed(bytes)
    subject.first.should == "abc123"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jruby-msgpack-0.0.1 spec/unpacker_spec.rb