msgpack 0.7.0dev1-java → 0.7.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/msgpack/msgpack.jar +0 -0
- data/lib/msgpack/version.rb +1 -1
- data/spec/cruby/unpacker_spec.rb +0 -247
- data/spec/factory_spec.rb +0 -3
- data/spec/jruby/{msgpack/unpacker_spec.rb → unpacker_spec.rb} +30 -159
- data/spec/msgpack_spec.rb +1 -1
- data/spec/packer_spec.rb +135 -4
- data/spec/unpacker_spec.rb +465 -6
- metadata +9 -23
- data/spec/cruby/packer_spec.rb +0 -138
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msgpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
- Theo Hultberg
|
9
|
+
- Satoshi Tagomori
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2015-
|
13
|
+
date: 2015-10-24 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,20 +54,6 @@ dependencies:
|
|
53
54
|
- - ~>
|
54
55
|
- !ruby/object:Gem::Version
|
55
56
|
version: 0.9.4
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.4.3
|
62
|
-
name: rake-compiler-dock
|
63
|
-
prerelease: false
|
64
|
-
type: :development
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 0.4.3
|
70
57
|
- !ruby/object:Gem::Dependency
|
71
58
|
requirement: !ruby/object:Gem::Requirement
|
72
59
|
requirements:
|
@@ -113,6 +100,7 @@ description: MessagePack is a binary-based efficient object serialization librar
|
|
113
100
|
email:
|
114
101
|
- frsyuki@gmail.com
|
115
102
|
- theo@iconara.net
|
103
|
+
- tagomoris@gmail.com
|
116
104
|
executables: []
|
117
105
|
extensions: []
|
118
106
|
extra_rdoc_files: []
|
@@ -131,7 +119,6 @@ files:
|
|
131
119
|
- spec/cruby/buffer_packer.rb
|
132
120
|
- spec/cruby/buffer_spec.rb
|
133
121
|
- spec/cruby/buffer_unpacker.rb
|
134
|
-
- spec/cruby/packer_spec.rb
|
135
122
|
- spec/cruby/unpacker_spec.rb
|
136
123
|
- spec/ext_value_spec.rb
|
137
124
|
- spec/exttypes.rb
|
@@ -139,7 +126,7 @@ files:
|
|
139
126
|
- spec/format_spec.rb
|
140
127
|
- spec/jruby/benchmarks/shootout_bm.rb
|
141
128
|
- spec/jruby/benchmarks/symbolize_keys_bm.rb
|
142
|
-
- spec/jruby/
|
129
|
+
- spec/jruby/unpacker_spec.rb
|
143
130
|
- spec/msgpack_spec.rb
|
144
131
|
- spec/pack_spec.rb
|
145
132
|
- spec/packer_spec.rb
|
@@ -162,12 +149,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
149
|
version: '0'
|
163
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
151
|
requirements:
|
165
|
-
- - '
|
152
|
+
- - '>='
|
166
153
|
- !ruby/object:Gem::Version
|
167
|
-
version:
|
154
|
+
version: '0'
|
168
155
|
requirements: []
|
169
156
|
rubyforge_project: msgpack
|
170
|
-
rubygems_version: 2.4.
|
157
|
+
rubygems_version: 2.4.8
|
171
158
|
signing_key:
|
172
159
|
specification_version: 4
|
173
160
|
summary: MessagePack, a binary-based efficient data interchange format.
|
@@ -180,7 +167,6 @@ test_files:
|
|
180
167
|
- spec/cruby/buffer_packer.rb
|
181
168
|
- spec/cruby/buffer_spec.rb
|
182
169
|
- spec/cruby/buffer_unpacker.rb
|
183
|
-
- spec/cruby/packer_spec.rb
|
184
170
|
- spec/cruby/unpacker_spec.rb
|
185
171
|
- spec/ext_value_spec.rb
|
186
172
|
- spec/exttypes.rb
|
@@ -188,7 +174,7 @@ test_files:
|
|
188
174
|
- spec/format_spec.rb
|
189
175
|
- spec/jruby/benchmarks/shootout_bm.rb
|
190
176
|
- spec/jruby/benchmarks/symbolize_keys_bm.rb
|
191
|
-
- spec/jruby/
|
177
|
+
- spec/jruby/unpacker_spec.rb
|
192
178
|
- spec/msgpack_spec.rb
|
193
179
|
- spec/pack_spec.rb
|
194
180
|
- spec/packer_spec.rb
|
data/spec/cruby/packer_spec.rb
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
# encoding: ascii-8bit
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
require 'stringio'
|
5
|
-
if defined?(Encoding)
|
6
|
-
Encoding.default_external = 'ASCII-8BIT'
|
7
|
-
end
|
8
|
-
|
9
|
-
describe Packer do
|
10
|
-
let :packer do
|
11
|
-
Packer.new
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'initialize' do
|
15
|
-
Packer.new
|
16
|
-
Packer.new(nil)
|
17
|
-
Packer.new(StringIO.new)
|
18
|
-
Packer.new({})
|
19
|
-
Packer.new(StringIO.new, {})
|
20
|
-
end
|
21
|
-
|
22
|
-
#it 'Packer' do
|
23
|
-
# Packer(packer).object_id.should == packer.object_id
|
24
|
-
# Packer(nil).class.should == Packer
|
25
|
-
# Packer('').class.should == Packer
|
26
|
-
# Packer('initbuf').to_s.should == 'initbuf'
|
27
|
-
#end
|
28
|
-
|
29
|
-
it 'write' do
|
30
|
-
packer.write([])
|
31
|
-
packer.to_s.should == "\x90"
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'write_nil' do
|
35
|
-
packer.write_nil
|
36
|
-
packer.to_s.should == "\xc0"
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'write_array_header 0' do
|
40
|
-
packer.write_array_header(0)
|
41
|
-
packer.to_s.should == "\x90"
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'write_array_header 1' do
|
45
|
-
packer.write_array_header(1)
|
46
|
-
packer.to_s.should == "\x91"
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'write_map_header 0' do
|
50
|
-
packer.write_map_header(0)
|
51
|
-
packer.to_s.should == "\x80"
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'write_map_header 1' do
|
55
|
-
packer.write_map_header(1)
|
56
|
-
packer.to_s.should == "\x81"
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'flush' do
|
60
|
-
io = StringIO.new
|
61
|
-
pk = Packer.new(io)
|
62
|
-
pk.write_nil
|
63
|
-
pk.flush
|
64
|
-
pk.to_s.should == ''
|
65
|
-
io.string.should == "\xc0"
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'to_msgpack returns String' do
|
69
|
-
nil.to_msgpack.class.should == String
|
70
|
-
true.to_msgpack.class.should == String
|
71
|
-
false.to_msgpack.class.should == String
|
72
|
-
1.to_msgpack.class.should == String
|
73
|
-
1.0.to_msgpack.class.should == String
|
74
|
-
"".to_msgpack.class.should == String
|
75
|
-
Hash.new.to_msgpack.class.should == String
|
76
|
-
Array.new.to_msgpack.class.should == String
|
77
|
-
end
|
78
|
-
|
79
|
-
class CustomPack01
|
80
|
-
def to_msgpack(pk=nil)
|
81
|
-
return MessagePack.pack(self, pk) unless pk.class == MessagePack::Packer
|
82
|
-
pk.write_array_header(2)
|
83
|
-
pk.write(1)
|
84
|
-
pk.write(2)
|
85
|
-
return pk
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
class CustomPack02
|
90
|
-
def to_msgpack(pk=nil)
|
91
|
-
[1,2].to_msgpack(pk)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'calls custom to_msgpack method' do
|
96
|
-
MessagePack.pack(CustomPack01.new).should == [1,2].to_msgpack
|
97
|
-
MessagePack.pack(CustomPack02.new).should == [1,2].to_msgpack
|
98
|
-
CustomPack01.new.to_msgpack.should == [1,2].to_msgpack
|
99
|
-
CustomPack02.new.to_msgpack.should == [1,2].to_msgpack
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'calls custom to_msgpack method with io' do
|
103
|
-
s01 = StringIO.new
|
104
|
-
MessagePack.pack(CustomPack01.new, s01)
|
105
|
-
s01.string.should == [1,2].to_msgpack
|
106
|
-
|
107
|
-
s02 = StringIO.new
|
108
|
-
MessagePack.pack(CustomPack02.new, s02)
|
109
|
-
s02.string.should == [1,2].to_msgpack
|
110
|
-
|
111
|
-
s03 = StringIO.new
|
112
|
-
CustomPack01.new.to_msgpack(s03)
|
113
|
-
s03.string.should == [1,2].to_msgpack
|
114
|
-
|
115
|
-
s04 = StringIO.new
|
116
|
-
CustomPack02.new.to_msgpack(s04)
|
117
|
-
s04.string.should == [1,2].to_msgpack
|
118
|
-
end
|
119
|
-
|
120
|
-
context 'in compatibility mode' do
|
121
|
-
it 'does not use the bin types' do
|
122
|
-
packed = MessagePack.pack('hello'.force_encoding(Encoding::BINARY), compatibility_mode: true)
|
123
|
-
packed.should eq("\xA5hello")
|
124
|
-
packed = MessagePack.pack(('hello' * 100).force_encoding(Encoding::BINARY), compatibility_mode: true)
|
125
|
-
packed.should start_with("\xDA\x01\xF4")
|
126
|
-
|
127
|
-
packer = MessagePack::Packer.new(compatibility_mode: 1)
|
128
|
-
packed = packer.pack(('hello' * 100).force_encoding(Encoding::BINARY))
|
129
|
-
packed.to_str.should start_with("\xDA\x01\xF4")
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'does not use the str8 type' do
|
133
|
-
packed = MessagePack.pack('x' * 32, compatibility_mode: true)
|
134
|
-
packed.should start_with("\xDA\x00\x20")
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|