msgpack 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +6 -0
- data/ext/java/org/msgpack/jruby/ExtensionRegistry.java +4 -9
- data/ext/msgpack/buffer_class.c +4 -4
- data/ext/msgpack/extconf.rb +3 -1
- data/ext/msgpack/packer.c +1 -0
- data/ext/msgpack/packer_class.c +5 -19
- data/ext/msgpack/rbinit.c +1 -1
- data/ext/msgpack/unpacker.c +1 -0
- data/ext/msgpack/unpacker_class.c +5 -7
- data/lib/msgpack/buffer.rb +9 -0
- data/lib/msgpack/packer.rb +4 -0
- data/lib/msgpack/unpacker.rb +4 -0
- data/lib/msgpack/version.rb +1 -1
- data/lib/msgpack.rb +1 -0
- data/msgpack.gemspec +5 -2
- metadata +18 -47
- data/.github/workflows/ci.yaml +0 -57
- data/.gitignore +0 -23
- data/.rubocop.yml +0 -36
- data/Gemfile +0 -9
- data/Rakefile +0 -70
- data/appveyor.yml +0 -18
- data/bench/bench.rb +0 -78
- data/bin/console +0 -8
- data/doclib/msgpack/buffer.rb +0 -193
- data/doclib/msgpack/core_ext.rb +0 -101
- data/doclib/msgpack/error.rb +0 -19
- data/doclib/msgpack/extension_value.rb +0 -9
- data/doclib/msgpack/factory.rb +0 -145
- data/doclib/msgpack/packer.rb +0 -209
- data/doclib/msgpack/time.rb +0 -22
- data/doclib/msgpack/timestamp.rb +0 -44
- data/doclib/msgpack/unpacker.rb +0 -183
- data/doclib/msgpack.rb +0 -87
- data/msgpack.org.md +0 -46
- data/spec/bigint_spec.rb +0 -26
- data/spec/cases.json +0 -1
- data/spec/cases.msg +0 -0
- data/spec/cases_compact.msg +0 -0
- data/spec/cases_spec.rb +0 -39
- data/spec/cruby/buffer_io_spec.rb +0 -255
- data/spec/cruby/buffer_packer.rb +0 -29
- data/spec/cruby/buffer_spec.rb +0 -592
- data/spec/cruby/buffer_unpacker.rb +0 -19
- data/spec/cruby/unpacker_spec.rb +0 -70
- data/spec/ext_value_spec.rb +0 -99
- data/spec/exttypes.rb +0 -51
- data/spec/factory_spec.rb +0 -706
- data/spec/format_spec.rb +0 -301
- data/spec/jruby/benchmarks/shootout_bm.rb +0 -73
- data/spec/jruby/benchmarks/symbolize_keys_bm.rb +0 -25
- data/spec/jruby/unpacker_spec.rb +0 -186
- data/spec/msgpack_spec.rb +0 -214
- data/spec/pack_spec.rb +0 -61
- data/spec/packer_spec.rb +0 -575
- data/spec/random_compat.rb +0 -24
- data/spec/spec_helper.rb +0 -72
- data/spec/timestamp_spec.rb +0 -159
- data/spec/unpack_spec.rb +0 -57
- data/spec/unpacker_spec.rb +0 -869
data/spec/ext_value_spec.rb
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
# encoding: ascii-8bit
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe MessagePack::ExtensionValue do
|
5
|
-
subject do
|
6
|
-
described_class.new(1, "data")
|
7
|
-
end
|
8
|
-
|
9
|
-
describe '#type/#type=' do
|
10
|
-
it 'returns value set by #initialize' do
|
11
|
-
subject.type.should == 1
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'assigns a value' do
|
15
|
-
subject.type = 2
|
16
|
-
subject.type.should == 2
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '#payload/#payload=' do
|
21
|
-
it 'returns value set by #initialize' do
|
22
|
-
subject.payload.should == "data"
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'assigns a value' do
|
26
|
-
subject.payload = "a"
|
27
|
-
subject.payload.should == "a"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#==/#eql?/#hash' do
|
32
|
-
it 'returns equivalent if the content is same' do
|
33
|
-
ext1 = MessagePack::ExtensionValue.new(1, "data")
|
34
|
-
ext2 = MessagePack::ExtensionValue.new(1, "data")
|
35
|
-
(ext1 == ext2).should be true
|
36
|
-
ext1.eql?(ext2).should be true
|
37
|
-
(ext1.hash == ext2.hash).should be true
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'returns not equivalent if type is not same' do
|
41
|
-
ext1 = MessagePack::ExtensionValue.new(1, "data")
|
42
|
-
ext2 = MessagePack::ExtensionValue.new(2, "data")
|
43
|
-
(ext1 == ext2).should be false
|
44
|
-
ext1.eql?(ext2).should be false
|
45
|
-
(ext1.hash == ext2.hash).should be false
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'returns not equivalent if payload is not same' do
|
49
|
-
ext1 = MessagePack::ExtensionValue.new(1, "data")
|
50
|
-
ext2 = MessagePack::ExtensionValue.new(1, "value")
|
51
|
-
(ext1 == ext2).should be false
|
52
|
-
ext1.eql?(ext2).should be false
|
53
|
-
(ext1.hash == ext2.hash).should be false
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe '#to_msgpack' do
|
58
|
-
it 'serializes very short payload' do
|
59
|
-
ext = MessagePack::ExtensionValue.new(1, "a"*2).to_msgpack
|
60
|
-
ext.should == "\xd5\x01" + "a"*2
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'serializes short payload' do
|
64
|
-
ext = MessagePack::ExtensionValue.new(1, "a"*18).to_msgpack
|
65
|
-
ext.should == "\xc7\x12\x01" + "a"*18
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'serializes long payload' do
|
69
|
-
ext = MessagePack::ExtensionValue.new(1, "a"*65540).to_msgpack
|
70
|
-
ext.should == "\xc9\x00\x01\x00\x04\x01" + "a"*65540
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'with a packer serializes to a packer' do
|
74
|
-
ext = MessagePack::ExtensionValue.new(1, "aa")
|
75
|
-
packer = MessagePack::Packer.new
|
76
|
-
ext.to_msgpack(packer)
|
77
|
-
packer.buffer.to_s.should == "\xd5\x01aa"
|
78
|
-
end
|
79
|
-
|
80
|
-
[-129, -65540, -(2**40), 128, 65540, 2**40].each do |type|
|
81
|
-
context "with invalid type (#{type})" do
|
82
|
-
it 'raises RangeError' do
|
83
|
-
lambda { MessagePack::ExtensionValue.new(type, "a").to_msgpack }.should raise_error(RangeError)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe '#dup' do
|
90
|
-
it 'duplicates' do
|
91
|
-
ext1 = MessagePack::ExtensionValue.new(1, "data")
|
92
|
-
ext2 = ext1.dup
|
93
|
-
ext2.type = 2
|
94
|
-
ext2.payload = "data2"
|
95
|
-
ext1.type.should == 1
|
96
|
-
ext1.payload.should == "data"
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
data/spec/exttypes.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
class DummyTimeStamp1
|
2
|
-
TYPE = 15
|
3
|
-
|
4
|
-
attr_reader :utime, :usec, :time
|
5
|
-
|
6
|
-
def initialize(utime, usec)
|
7
|
-
@utime = utime
|
8
|
-
@usec = usec
|
9
|
-
@time = Time.at(utime, usec)
|
10
|
-
end
|
11
|
-
|
12
|
-
def ==(other)
|
13
|
-
self.utime == other.utime && self.usec == other.usec
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.type_id
|
17
|
-
15
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.from_msgpack_ext(data)
|
21
|
-
new(*data.unpack('I*'))
|
22
|
-
end
|
23
|
-
|
24
|
-
def to_msgpack_ext
|
25
|
-
[@utime,@usec].pack('I*')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class DummyTimeStamp2
|
30
|
-
TYPE = 16
|
31
|
-
|
32
|
-
attr_reader :utime, :usec, :time
|
33
|
-
|
34
|
-
def initialize(utime, usec)
|
35
|
-
@utime = utime
|
36
|
-
@usec = usec
|
37
|
-
@time = Time.at(utime, usec)
|
38
|
-
end
|
39
|
-
|
40
|
-
def ==(other)
|
41
|
-
self.utime == other.utime && self.usec == other.usec
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.deserialize(data)
|
45
|
-
new(* data.split(',', 2).map(&:to_i))
|
46
|
-
end
|
47
|
-
|
48
|
-
def serialize
|
49
|
-
[@utime,@usec].map(&:to_s).join(',')
|
50
|
-
end
|
51
|
-
end
|