Hackfut Security File Manager
Current Path:
/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/msgpack-1.2.9/spec
opt
/
td-agent
/
embedded
/
lib
/
ruby
/
gems
/
2.4.0
/
gems
/
msgpack-1.2.9
/
spec
/
📁
..
📄
cases.json
(220 B)
📄
cases.msg
(213 B)
📄
cases_compact.msg
(116 B)
📄
cases_spec.rb
(718 B)
📁
cruby
📄
ext_value_spec.rb
(2.73 KB)
📄
exttypes.rb
(823 B)
📄
factory_spec.rb
(11.02 KB)
📄
format_spec.rb
(5.58 KB)
📁
jruby
📄
msgpack_spec.rb
(7.53 KB)
📄
pack_spec.rb
(1.61 KB)
📄
packer_spec.rb
(15.78 KB)
📄
random_compat.rb
(334 B)
📄
spec_helper.rb
(742 B)
📄
unpack_spec.rb
(2.22 KB)
📄
unpacker_spec.rb
(20.59 KB)
Editing: unpack_spec.rb
# encoding: ascii-8bit require 'spec_helper' require 'stringio' if defined?(Encoding) Encoding.default_external = 'ASCII-8BIT' end describe MessagePack do it 'MessagePack.unpack symbolize_keys' do symbolized_hash = {:a => 'b', :c => 'd'} MessagePack.load(MessagePack.pack(symbolized_hash), :symbolize_keys => true).should == symbolized_hash MessagePack.unpack(MessagePack.pack(symbolized_hash), :symbolize_keys => true).should == symbolized_hash end it 'Unpacker#read symbolize_keys' do unpacker = MessagePack::Unpacker.new(:symbolize_keys => true) symbolized_hash = {:a => 'b', :c => 'd'} unpacker.feed(MessagePack.pack(symbolized_hash)).read.should == symbolized_hash end it "msgpack str 8 type" do MessagePack.unpack([0xd9, 0x00].pack('C*')).should == "" MessagePack.unpack([0xd9, 0x01].pack('C*') + 'a').should == "a" MessagePack.unpack([0xd9, 0x02].pack('C*') + 'aa').should == "aa" end it "msgpack str 16 type" do MessagePack.unpack([0xda, 0x00, 0x00].pack('C*')).should == "" MessagePack.unpack([0xda, 0x00, 0x01].pack('C*') + 'a').should == "a" MessagePack.unpack([0xda, 0x00, 0x02].pack('C*') + 'aa').should == "aa" end it "msgpack str 32 type" do MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x00].pack('C*')).should == "" MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x01].pack('C*') + 'a').should == "a" MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x02].pack('C*') + 'aa').should == "aa" end it "msgpack bin 8 type" do MessagePack.unpack([0xc4, 0x00].pack('C*')).should == "" MessagePack.unpack([0xc4, 0x01].pack('C*') + 'a').should == "a" MessagePack.unpack([0xc4, 0x02].pack('C*') + 'aa').should == "aa" end it "msgpack bin 16 type" do MessagePack.unpack([0xc5, 0x00, 0x00].pack('C*')).should == "" MessagePack.unpack([0xc5, 0x00, 0x01].pack('C*') + 'a').should == "a" MessagePack.unpack([0xc5, 0x00, 0x02].pack('C*') + 'aa').should == "aa" end it "msgpack bin 32 type" do MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x00].pack('C*')).should == "" MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x01].pack('C*') + 'a').should == "a" MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x02].pack('C*') + 'aa').should == "aa" end end
Upload File
Create Folder