msgpack 0.5.9-x86-mingw32 → 0.5.10-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -2
- data/.travis.yml +2 -3
- data/ChangeLog +6 -0
- data/Rakefile +5 -1
- data/ext/java/org/msgpack/jruby/Buffer.java +221 -0
- data/ext/java/org/msgpack/jruby/Decoder.java +201 -0
- data/ext/java/org/msgpack/jruby/Encoder.java +309 -0
- data/ext/java/org/msgpack/jruby/ExtensionValue.java +136 -0
- data/ext/java/org/msgpack/jruby/MessagePackLibrary.java +113 -0
- data/ext/java/org/msgpack/jruby/Packer.java +78 -0
- data/ext/java/org/msgpack/jruby/Types.java +37 -0
- data/ext/java/org/msgpack/jruby/Unpacker.java +170 -0
- data/lib/msgpack.rb +11 -4
- data/lib/msgpack/version.rb +1 -1
- data/msgpack.gemspec +11 -6
- data/spec/{packer_spec.rb → cruby/packer_spec.rb} +0 -0
- data/spec/{unpacker_spec.rb → cruby/unpacker_spec.rb} +0 -0
- data/spec/format_spec.rb +32 -30
- data/spec/jruby/benchmarks/shootout_bm.rb +73 -0
- data/spec/jruby/benchmarks/symbolize_keys_bm.rb +25 -0
- data/spec/jruby/msgpack/unpacker_spec.rb +290 -0
- data/spec/jruby/msgpack_spec.rb +136 -0
- data/spec/pack_spec.rb +67 -0
- data/spec/spec_helper.rb +10 -4
- data/spec/unpack_spec.rb +72 -0
- metadata +22 -5
data/spec/pack_spec.rb
ADDED
@@ -0,0 +1,67 @@
|
|
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 MessagePack do
|
10
|
+
it 'to_msgpack returns String' do
|
11
|
+
nil.to_msgpack.class.should == String
|
12
|
+
true.to_msgpack.class.should == String
|
13
|
+
false.to_msgpack.class.should == String
|
14
|
+
1.to_msgpack.class.should == String
|
15
|
+
1.0.to_msgpack.class.should == String
|
16
|
+
"".to_msgpack.class.should == String
|
17
|
+
Hash.new.to_msgpack.class.should == String
|
18
|
+
Array.new.to_msgpack.class.should == String
|
19
|
+
end
|
20
|
+
|
21
|
+
class CustomPack01
|
22
|
+
def to_msgpack(pk=nil)
|
23
|
+
return MessagePack.pack(self, pk) unless pk.class == MessagePack::Packer
|
24
|
+
pk.write_array_header(2)
|
25
|
+
pk.write(1)
|
26
|
+
pk.write(2)
|
27
|
+
return pk
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class CustomPack02
|
32
|
+
def to_msgpack(pk=nil)
|
33
|
+
[1,2].to_msgpack(pk)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'calls custom to_msgpack method' do
|
38
|
+
if /java/ =~ RUBY_PLATFORM
|
39
|
+
skip "custom to_msgpack fallback is not supported yet in JRuby implementation"
|
40
|
+
end
|
41
|
+
MessagePack.pack(CustomPack01.new).should == [1,2].to_msgpack
|
42
|
+
MessagePack.pack(CustomPack02.new).should == [1,2].to_msgpack
|
43
|
+
CustomPack01.new.to_msgpack.should == [1,2].to_msgpack
|
44
|
+
CustomPack02.new.to_msgpack.should == [1,2].to_msgpack
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'calls custom to_msgpack method with io' do
|
48
|
+
if /java/ =~ RUBY_PLATFORM
|
49
|
+
skip "custom to_msgpack fallback with io is not supported yet in JRuby implementation"
|
50
|
+
end
|
51
|
+
s01 = StringIO.new
|
52
|
+
MessagePack.pack(CustomPack01.new, s01)
|
53
|
+
s01.string.should == [1,2].to_msgpack
|
54
|
+
|
55
|
+
s02 = StringIO.new
|
56
|
+
MessagePack.pack(CustomPack02.new, s02)
|
57
|
+
s02.string.should == [1,2].to_msgpack
|
58
|
+
|
59
|
+
s03 = StringIO.new
|
60
|
+
CustomPack01.new.to_msgpack(s03)
|
61
|
+
s03.string.should == [1,2].to_msgpack
|
62
|
+
|
63
|
+
s04 = StringIO.new
|
64
|
+
CustomPack02.new.to_msgpack(s04)
|
65
|
+
s04.string.should == [1,2].to_msgpack
|
66
|
+
end
|
67
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -15,7 +15,13 @@ end
|
|
15
15
|
|
16
16
|
require 'msgpack'
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
if /java/ =~ RUBY_PLATFORM
|
19
|
+
RSpec.configure do |c|
|
20
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
21
|
+
c.filter_run_excluding :encodings => !(defined? Encoding)
|
22
|
+
end
|
23
|
+
else
|
24
|
+
Packer = MessagePack::Packer
|
25
|
+
Unpacker = MessagePack::Unpacker
|
26
|
+
Buffer = MessagePack::Buffer
|
27
|
+
end
|
data/spec/unpack_spec.rb
ADDED
@@ -0,0 +1,72 @@
|
|
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 MessagePack do
|
10
|
+
it 'MessagePack.unpack symbolize_keys' do
|
11
|
+
symbolized_hash = {:a => 'b', :c => 'd'}
|
12
|
+
MessagePack.load(MessagePack.pack(symbolized_hash), :symbolize_keys => true).should == symbolized_hash
|
13
|
+
MessagePack.unpack(MessagePack.pack(symbolized_hash), :symbolize_keys => true).should == symbolized_hash
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'Unpacker#unpack symbolize_keys' do
|
17
|
+
if /java/ =~ RUBY_PLATFORM
|
18
|
+
skip "Unpacker#unpack returns nil in JRuby (incompatible)"
|
19
|
+
end
|
20
|
+
unpacker = MessagePack::Unpacker.new(:symbolize_keys => true)
|
21
|
+
symbolized_hash = {:a => 'b', :c => 'd'}
|
22
|
+
unpacker.feed(MessagePack.pack(symbolized_hash)).read.should == symbolized_hash
|
23
|
+
end
|
24
|
+
|
25
|
+
it "msgpack str 8 type" do
|
26
|
+
if /java/ =~ RUBY_PLATFORM
|
27
|
+
skip "str 8 type is not supported in JRuby (incompatibility)"
|
28
|
+
end
|
29
|
+
MessagePack.unpack([0xd9, 0x00].pack('C*')).should == ""
|
30
|
+
MessagePack.unpack([0xd9, 0x01].pack('C*') + 'a').should == "a"
|
31
|
+
MessagePack.unpack([0xd9, 0x02].pack('C*') + 'aa').should == "aa"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "msgpack str 16 type" do
|
35
|
+
MessagePack.unpack([0xda, 0x00, 0x00].pack('C*')).should == ""
|
36
|
+
MessagePack.unpack([0xda, 0x00, 0x01].pack('C*') + 'a').should == "a"
|
37
|
+
MessagePack.unpack([0xda, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "msgpack str 32 type" do
|
41
|
+
MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x00].pack('C*')).should == ""
|
42
|
+
MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x01].pack('C*') + 'a').should == "a"
|
43
|
+
MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
|
44
|
+
end
|
45
|
+
|
46
|
+
it "msgpack bin 8 type" do
|
47
|
+
if /java/ =~ RUBY_PLATFORM
|
48
|
+
skip "bin 8 type is not supported in JRuby (incompatibility)"
|
49
|
+
end
|
50
|
+
MessagePack.unpack([0xc4, 0x00].pack('C*')).should == ""
|
51
|
+
MessagePack.unpack([0xc4, 0x01].pack('C*') + 'a').should == "a"
|
52
|
+
MessagePack.unpack([0xc4, 0x02].pack('C*') + 'aa').should == "aa"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "msgpack bin 16 type" do
|
56
|
+
if /java/ =~ RUBY_PLATFORM
|
57
|
+
skip "bin 16 type is not supported in JRuby (incompatibility)"
|
58
|
+
end
|
59
|
+
MessagePack.unpack([0xc5, 0x00, 0x00].pack('C*')).should == ""
|
60
|
+
MessagePack.unpack([0xc5, 0x00, 0x01].pack('C*') + 'a').should == "a"
|
61
|
+
MessagePack.unpack([0xc5, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
|
62
|
+
end
|
63
|
+
|
64
|
+
it "msgpack bin 32 type" do
|
65
|
+
if /java/ =~ RUBY_PLATFORM
|
66
|
+
skip "bin 32 type is not supported in JRuby (incompatibility)"
|
67
|
+
end
|
68
|
+
MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x00].pack('C*')).should == ""
|
69
|
+
MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x01].pack('C*') + 'a').should == "a"
|
70
|
+
MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
|
71
|
+
end
|
72
|
+
end
|
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.5.
|
4
|
+
version: 0.5.10
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
|
+
- Theo Hultberg
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date:
|
13
|
+
date: 2015-01-09 00:00:00 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -72,7 +73,9 @@ dependencies:
|
|
72
73
|
requirement: *id006
|
73
74
|
name: yard
|
74
75
|
description: MessagePack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small.
|
75
|
-
email:
|
76
|
+
email:
|
77
|
+
- frsyuki@gmail.com
|
78
|
+
- theo@iconara.net
|
76
79
|
executables: []
|
77
80
|
|
78
81
|
extensions: []
|
@@ -92,6 +95,14 @@ files:
|
|
92
95
|
- doclib/msgpack/error.rb
|
93
96
|
- doclib/msgpack/packer.rb
|
94
97
|
- doclib/msgpack/unpacker.rb
|
98
|
+
- ext/java/org/msgpack/jruby/Buffer.java
|
99
|
+
- ext/java/org/msgpack/jruby/Decoder.java
|
100
|
+
- ext/java/org/msgpack/jruby/Encoder.java
|
101
|
+
- ext/java/org/msgpack/jruby/ExtensionValue.java
|
102
|
+
- ext/java/org/msgpack/jruby/MessagePackLibrary.java
|
103
|
+
- ext/java/org/msgpack/jruby/Packer.java
|
104
|
+
- ext/java/org/msgpack/jruby/Types.java
|
105
|
+
- ext/java/org/msgpack/jruby/Unpacker.java
|
95
106
|
- ext/msgpack/buffer.c
|
96
107
|
- ext/msgpack/buffer.h
|
97
108
|
- ext/msgpack/buffer_class.c
|
@@ -129,11 +140,17 @@ files:
|
|
129
140
|
- spec/cruby/buffer_packer.rb
|
130
141
|
- spec/cruby/buffer_spec.rb
|
131
142
|
- spec/cruby/buffer_unpacker.rb
|
143
|
+
- spec/cruby/packer_spec.rb
|
144
|
+
- spec/cruby/unpacker_spec.rb
|
132
145
|
- spec/format_spec.rb
|
133
|
-
- spec/
|
146
|
+
- spec/jruby/benchmarks/shootout_bm.rb
|
147
|
+
- spec/jruby/benchmarks/symbolize_keys_bm.rb
|
148
|
+
- spec/jruby/msgpack/unpacker_spec.rb
|
149
|
+
- spec/jruby/msgpack_spec.rb
|
150
|
+
- spec/pack_spec.rb
|
134
151
|
- spec/random_compat.rb
|
135
152
|
- spec/spec_helper.rb
|
136
|
-
- spec/
|
153
|
+
- spec/unpack_spec.rb
|
137
154
|
homepage: http://msgpack.org/
|
138
155
|
licenses:
|
139
156
|
- Apache 2.0
|