msgpack 1.4.3 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yaml +7 -6
  3. data/ChangeLog +18 -0
  4. data/README.md +22 -0
  5. data/Rakefile +1 -2
  6. data/doclib/msgpack/factory.rb +46 -3
  7. data/doclib/msgpack/packer.rb +5 -4
  8. data/doclib/msgpack/unpacker.rb +2 -2
  9. data/ext/java/org/msgpack/jruby/Buffer.java +6 -0
  10. data/ext/java/org/msgpack/jruby/Decoder.java +23 -19
  11. data/ext/java/org/msgpack/jruby/Encoder.java +45 -18
  12. data/ext/java/org/msgpack/jruby/ExtensionRegistry.java +28 -40
  13. data/ext/java/org/msgpack/jruby/Factory.java +40 -5
  14. data/ext/java/org/msgpack/jruby/Packer.java +21 -11
  15. data/ext/java/org/msgpack/jruby/Unpacker.java +44 -22
  16. data/ext/msgpack/buffer.h +2 -2
  17. data/ext/msgpack/buffer_class.c +23 -15
  18. data/ext/msgpack/factory_class.c +78 -16
  19. data/ext/msgpack/packer.c +42 -5
  20. data/ext/msgpack/packer.h +24 -0
  21. data/ext/msgpack/packer_class.c +29 -22
  22. data/ext/msgpack/packer_ext_registry.c +23 -9
  23. data/ext/msgpack/packer_ext_registry.h +38 -31
  24. data/ext/msgpack/unpacker.c +37 -19
  25. data/ext/msgpack/unpacker.h +2 -2
  26. data/ext/msgpack/unpacker_class.c +26 -45
  27. data/ext/msgpack/unpacker_ext_registry.c +40 -16
  28. data/ext/msgpack/unpacker_ext_registry.h +21 -14
  29. data/lib/msgpack/bigint.rb +69 -0
  30. data/lib/msgpack/factory.rb +103 -0
  31. data/lib/msgpack/symbol.rb +8 -1
  32. data/lib/msgpack/version.rb +1 -1
  33. data/lib/msgpack.rb +4 -5
  34. data/msgpack.gemspec +1 -2
  35. data/spec/bigint_spec.rb +26 -0
  36. data/spec/factory_spec.rb +263 -14
  37. data/spec/spec_helper.rb +3 -4
  38. data/spec/timestamp_spec.rb +0 -2
  39. data/spec/unpacker_spec.rb +22 -3
  40. metadata +7 -29
@@ -2,8 +2,6 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- IS_JRUBY = Kernel.const_defined?(:JRUBY_VERSION)
6
-
7
5
  describe MessagePack::Timestamp do
8
6
  describe 'malformed format' do
9
7
  it do
@@ -1,5 +1,3 @@
1
- # encoding: ascii-8bit
2
-
3
1
  require 'stringio'
4
2
  require 'tempfile'
5
3
  require 'zlib'
@@ -302,6 +300,21 @@ describe MessagePack::Unpacker do
302
300
  MessagePack.unpack(MessagePack.pack(symbolized_hash), :symbolize_keys => true).should == symbolized_hash
303
301
  end
304
302
 
303
+ it 'MessagePack.unpack symbolize_keys preserve encoding' do
304
+ hash = { :ascii => 1, :utf8_é => 2}
305
+ loaded_hash = MessagePack.load(MessagePack.pack(hash), :symbolize_keys => true)
306
+
307
+ hash.keys[0].encoding.should == Encoding::US_ASCII # Ruby coerce symbols to US-ASCII when possible.
308
+ loaded_hash.keys[0].should == hash.keys[0]
309
+ loaded_hash.keys[0].encoding.should == hash.keys[0].encoding
310
+
311
+ hash.keys[1].encoding.should == Encoding::UTF_8
312
+ loaded_hash.keys[1].should == hash.keys[1]
313
+ loaded_hash.keys[1].encoding.should == hash.keys[1].encoding
314
+
315
+ MessagePack.unpack(MessagePack.pack(hash), :symbolize_keys => true).should == hash
316
+ end
317
+
305
318
  it 'Unpacker#unpack symbolize_keys' do
306
319
  unpacker = MessagePack::Unpacker.new(:symbolize_keys => true)
307
320
  symbolized_hash = {:a => 'b', :c => 'd'}
@@ -765,7 +778,13 @@ describe MessagePack::Unpacker do
765
778
 
766
779
  context 'binary encoding', :encodings do
767
780
  let :buffer do
768
- MessagePack.pack({'hello' => 'world', 'nested' => ['object', {'structure' => true}]})
781
+ MessagePack.pack({
782
+ 'hello'.b => 'world'.b,
783
+ 'nested'.b => [
784
+ 'object'.b,
785
+ {'structure'.b => true},
786
+ ]
787
+ })
769
788
  end
770
789
 
771
790
  let :unpacker do
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: 1.4.3
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-01-20 00:00:00.000000000 Z
13
+ date: 2022-04-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '0'
49
+ version: 1.1.9
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: '0'
56
+ version: 1.1.9
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rspec
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -176,6 +176,7 @@ files:
176
176
  - ext/msgpack/unpacker_ext_registry.c
177
177
  - ext/msgpack/unpacker_ext_registry.h
178
178
  - lib/msgpack.rb
179
+ - lib/msgpack/bigint.rb
179
180
  - lib/msgpack/core_ext.rb
180
181
  - lib/msgpack/factory.rb
181
182
  - lib/msgpack/packer.rb
@@ -186,6 +187,7 @@ files:
186
187
  - lib/msgpack/version.rb
187
188
  - msgpack.gemspec
188
189
  - msgpack.org.md
190
+ - spec/bigint_spec.rb
189
191
  - spec/cases.json
190
192
  - spec/cases.msg
191
193
  - spec/cases_compact.msg
@@ -233,28 +235,4 @@ rubygems_version: 3.3.3
233
235
  signing_key:
234
236
  specification_version: 4
235
237
  summary: MessagePack, a binary-based efficient data interchange format.
236
- test_files:
237
- - spec/cases.json
238
- - spec/cases.msg
239
- - spec/cases_compact.msg
240
- - spec/cases_spec.rb
241
- - spec/cruby/buffer_io_spec.rb
242
- - spec/cruby/buffer_packer.rb
243
- - spec/cruby/buffer_spec.rb
244
- - spec/cruby/buffer_unpacker.rb
245
- - spec/cruby/unpacker_spec.rb
246
- - spec/ext_value_spec.rb
247
- - spec/exttypes.rb
248
- - spec/factory_spec.rb
249
- - spec/format_spec.rb
250
- - spec/jruby/benchmarks/shootout_bm.rb
251
- - spec/jruby/benchmarks/symbolize_keys_bm.rb
252
- - spec/jruby/unpacker_spec.rb
253
- - spec/msgpack_spec.rb
254
- - spec/pack_spec.rb
255
- - spec/packer_spec.rb
256
- - spec/random_compat.rb
257
- - spec/spec_helper.rb
258
- - spec/timestamp_spec.rb
259
- - spec/unpack_spec.rb
260
- - spec/unpacker_spec.rb
238
+ test_files: []