msgpack 0.5.12-java → 0.6.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4298a20fb1f4ffb9b85b3c5a2c572bfe81538b5
4
- data.tar.gz: 983b69036662b8e863b9243d8ec35597845e8e34
3
+ metadata.gz: 3f1732b4971f468854c721a7c86ab90561b72b6a
4
+ data.tar.gz: ef5093874e8f8299caaa9bb57fbd00bff792cfeb
5
5
  SHA512:
6
- metadata.gz: 8704975e16c1e7f8ac3f85e048680d8f78daa9deaba983d48c2c3630802b211ae9bc0483c0b5befe4edbbe1ed37742912aaf3eddd6d9086a1821308e184a99c1
7
- data.tar.gz: aff4ddfe43fa7e24ef400c9a84e9f963b86b9a46588292f4bd2fe79ecc82dd797121ae896526daa9c1b6bca04b1c2085dd8459d1b0671560f4a012d65140e920
6
+ metadata.gz: e6227891292406ec9fb672465654a05c1522f3e1ad67d0d6a79641f43351bbcaa11aa7b5d53a592d3f1d408f0128a5c76a01594097e3d368df10b8cc24a64437
7
+ data.tar.gz: 7596f51ce145a165ef13b67811b44e69b115aa57f8e0d49448bdc4981652b8f6f5ff15506c832c69b53041a0d9a4b0ffcb7cdb4fdef25943d17b653173b1c8a8
Binary file
@@ -1,3 +1,3 @@
1
1
  module MessagePack
2
- VERSION = "0.5.12"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -262,36 +262,42 @@ describe Unpacker do
262
262
 
263
263
  it "msgpack str 8 type" do
264
264
  MessagePack.unpack([0xd9, 0x00].pack('C*')).should == ""
265
+ MessagePack.unpack([0xd9, 0x00].pack('C*')).encoding.should == Encoding::UTF_8
265
266
  MessagePack.unpack([0xd9, 0x01].pack('C*') + 'a').should == "a"
266
267
  MessagePack.unpack([0xd9, 0x02].pack('C*') + 'aa').should == "aa"
267
268
  end
268
269
 
269
270
  it "msgpack str 16 type" do
270
271
  MessagePack.unpack([0xda, 0x00, 0x00].pack('C*')).should == ""
272
+ MessagePack.unpack([0xda, 0x00, 0x00].pack('C*')).encoding.should == Encoding::UTF_8
271
273
  MessagePack.unpack([0xda, 0x00, 0x01].pack('C*') + 'a').should == "a"
272
274
  MessagePack.unpack([0xda, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
273
275
  end
274
276
 
275
277
  it "msgpack str 32 type" do
276
278
  MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x00].pack('C*')).should == ""
279
+ MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x00].pack('C*')).encoding.should == Encoding::UTF_8
277
280
  MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x01].pack('C*') + 'a').should == "a"
278
281
  MessagePack.unpack([0xdb, 0x00, 0x00, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
279
282
  end
280
283
 
281
284
  it "msgpack bin 8 type" do
282
285
  MessagePack.unpack([0xc4, 0x00].pack('C*')).should == ""
286
+ MessagePack.unpack([0xc4, 0x00].pack('C*')).encoding.should == Encoding::ASCII_8BIT
283
287
  MessagePack.unpack([0xc4, 0x01].pack('C*') + 'a').should == "a"
284
288
  MessagePack.unpack([0xc4, 0x02].pack('C*') + 'aa').should == "aa"
285
289
  end
286
290
 
287
291
  it "msgpack bin 16 type" do
288
292
  MessagePack.unpack([0xc5, 0x00, 0x00].pack('C*')).should == ""
293
+ MessagePack.unpack([0xc5, 0x00, 0x00].pack('C*')).encoding.should == Encoding::ASCII_8BIT
289
294
  MessagePack.unpack([0xc5, 0x00, 0x01].pack('C*') + 'a').should == "a"
290
295
  MessagePack.unpack([0xc5, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
291
296
  end
292
297
 
293
298
  it "msgpack bin 32 type" do
294
299
  MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x00].pack('C*')).should == ""
300
+ MessagePack.unpack([0xc6, 0x0, 0x00, 0x00, 0x000].pack('C*')).encoding.should == Encoding::ASCII_8BIT
295
301
  MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x01].pack('C*') + 'a').should == "a"
296
302
  MessagePack.unpack([0xc6, 0x00, 0x00, 0x00, 0x02].pack('C*') + 'aa').should == "aa"
297
303
  end
@@ -83,8 +83,13 @@ describe MessagePack do
83
83
  check_raw 1, (1 << 5)-1
84
84
  end
85
85
 
86
+ it "raw 8" do
87
+ check_raw 2, (1 << 5)
88
+ check_raw 2, (1 << 8)-1
89
+ end
90
+
86
91
  it "raw 16" do
87
- check_raw 3, (1 << 5)
92
+ check_raw 3, (1 << 8)
88
93
  check_raw 3, (1 << 16)-1
89
94
  end
90
95
 
@@ -93,6 +98,50 @@ describe MessagePack do
93
98
  #check_raw 5, (1 << 32)-1 # memory error
94
99
  end
95
100
 
101
+ it "str encoding is UTF_8" do
102
+ v = pack_unpack('string'.force_encoding(Encoding::UTF_8))
103
+ v.encoding.should == Encoding::UTF_8
104
+ end
105
+
106
+ it "str transcode US-ASCII" do
107
+ v = pack_unpack('string'.force_encoding(Encoding::US_ASCII))
108
+ v.encoding.should == Encoding::UTF_8
109
+ end
110
+
111
+ it "str transcode UTF-16" do
112
+ v = pack_unpack('string'.encode(Encoding::UTF_16))
113
+ v.encoding.should == Encoding::UTF_8
114
+ v.should == 'string'
115
+ end
116
+
117
+ it "str transcode EUC-JP 7bit safe" do
118
+ v = pack_unpack('string'.force_encoding(Encoding::EUC_JP))
119
+ v.encoding.should == Encoding::UTF_8
120
+ v.should == 'string'
121
+ end
122
+
123
+ it "str transcode EUC-JP 7bit unsafe" do
124
+ v = pack_unpack([0xa4, 0xa2].pack('C*').force_encoding(Encoding::EUC_JP))
125
+ v.encoding.should == Encoding::UTF_8
126
+ v.should == "\xE3\x81\x82".force_encoding('UTF-8')
127
+ end
128
+
129
+ it "bin 8" do
130
+ check_bin 2, (1<<8)-1
131
+ end
132
+
133
+ it "bin 16" do
134
+ check_bin 3, (1<<16)-1
135
+ end
136
+
137
+ it "bin 32" do
138
+ check_bin 5, (1<<16)
139
+ end
140
+
141
+ it "bin encoding is ASCII_8BIT" do
142
+ pack_unpack('string'.force_encoding(Encoding::ASCII_8BIT)).encoding.should == Encoding::ASCII_8BIT
143
+ end
144
+
96
145
  it "fixarray" do
97
146
  check_array 1, 0
98
147
  check_array 1, (1 << 4)-1
@@ -210,9 +259,11 @@ describe MessagePack do
210
259
  end
211
260
 
212
261
  def check_raw(overhead, num)
213
- rawstr = " "*num
214
- rawstr.force_encoding("UTF-8")
215
- check num+overhead, rawstr
262
+ check num+overhead, (" "*num).force_encoding(Encoding::UTF_8)
263
+ end
264
+
265
+ def check_bin(overhead, num)
266
+ check num+overhead, (" "*num).force_encoding(Encoding::ASCII_8BIT)
216
267
  end
217
268
 
218
269
  def check_array(overhead, num)
@@ -223,5 +274,9 @@ describe MessagePack do
223
274
  raw = obj.to_msgpack.to_s
224
275
  raw.should == buf
225
276
  end
277
+
278
+ def pack_unpack(obj)
279
+ MessagePack.unpack(obj.to_msgpack)
280
+ end
226
281
  end
227
282
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.6.0
5
5
  platform: java
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-21 00:00:00.000000000 Z
12
+ date: 2015-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement