msgpack 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yaml +56 -0
- data/ChangeLog +12 -0
- data/Rakefile +1 -2
- data/doclib/msgpack/factory.rb +1 -0
- data/ext/java/org/msgpack/jruby/Buffer.java +17 -16
- data/ext/java/org/msgpack/jruby/Decoder.java +6 -2
- data/ext/java/org/msgpack/jruby/Encoder.java +22 -12
- data/ext/java/org/msgpack/jruby/ExtensionRegistry.java +9 -9
- data/ext/java/org/msgpack/jruby/ExtensionValue.java +5 -8
- data/ext/java/org/msgpack/jruby/Factory.java +7 -2
- data/ext/java/org/msgpack/jruby/Packer.java +11 -9
- data/ext/java/org/msgpack/jruby/Unpacker.java +30 -28
- data/ext/msgpack/buffer.c +0 -5
- data/ext/msgpack/buffer.h +5 -0
- data/ext/msgpack/extconf.rb +0 -7
- data/ext/msgpack/factory_class.c +10 -5
- data/ext/msgpack/packer.c +18 -5
- data/ext/msgpack/packer.h +0 -9
- data/ext/msgpack/packer_class.c +0 -9
- data/ext/msgpack/packer_ext_registry.c +0 -22
- data/ext/msgpack/unpacker.c +28 -22
- data/ext/msgpack/unpacker.h +2 -0
- data/ext/msgpack/unpacker_class.c +0 -5
- data/lib/msgpack/symbol.rb +14 -4
- data/lib/msgpack/time.rb +1 -1
- data/lib/msgpack/version.rb +1 -1
- data/lib/msgpack.rb +1 -2
- data/msgpack.gemspec +1 -2
- data/spec/factory_spec.rb +17 -0
- data/spec/msgpack_spec.rb +1 -1
- data/spec/packer_spec.rb +18 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/timestamp_spec.rb +40 -0
- data/spec/unpacker_spec.rb +10 -1
- metadata +7 -31
- data/.travis.yml +0 -39
data/spec/packer_spec.rb
CHANGED
|
@@ -488,6 +488,24 @@ describe MessagePack::Packer do
|
|
|
488
488
|
it { is_expected.to eq "\xC7\x0F\x01value_msgpacked" }
|
|
489
489
|
end
|
|
490
490
|
|
|
491
|
+
shared_examples_for 'extension subclasses core type' do |klass|
|
|
492
|
+
before { stub_const('Value', Class.new(klass)) }
|
|
493
|
+
let(:object) { Value.new }
|
|
494
|
+
subject { packer.pack(object).to_s }
|
|
495
|
+
|
|
496
|
+
it "defaults to #{klass.name} packer if no extension is present" do
|
|
497
|
+
expect(subject).to eq(MessagePack.dump(klass.new))
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
it "uses core type extension for #{klass.name}" do
|
|
501
|
+
packer.register_type(0x01, Value, ->(_) { 'value_msgpacked' })
|
|
502
|
+
expect(subject).to eq("\xC7\x0F\x01value_msgpacked")
|
|
503
|
+
end
|
|
504
|
+
end
|
|
505
|
+
it_behaves_like 'extension subclasses core type', Hash
|
|
506
|
+
it_behaves_like 'extension subclasses core type', Array
|
|
507
|
+
it_behaves_like 'extension subclasses core type', String
|
|
508
|
+
|
|
491
509
|
context 'when registering a type for symbols' do
|
|
492
510
|
before { packer.register_type(0x00, ::Symbol, :to_msgpack_ext) }
|
|
493
511
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -15,6 +15,16 @@ end
|
|
|
15
15
|
|
|
16
16
|
require 'msgpack'
|
|
17
17
|
|
|
18
|
+
if GC.respond_to?(:verify_compaction_references)
|
|
19
|
+
# This method was added in Ruby 3.0.0. Calling it this way asks the GC to
|
|
20
|
+
# move objects around, helping to find object movement bugs.
|
|
21
|
+
GC.verify_compaction_references(double_heap: true, toward: :empty)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
if GC.respond_to?(:auto_compact=)
|
|
25
|
+
GC.auto_compact = true
|
|
26
|
+
end
|
|
27
|
+
|
|
18
28
|
def java?
|
|
19
29
|
/java/ =~ RUBY_PLATFORM
|
|
20
30
|
end
|
data/spec/timestamp_spec.rb
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
|
+
IS_JRUBY = Kernel.const_defined?(:JRUBY_VERSION)
|
|
6
|
+
|
|
5
7
|
describe MessagePack::Timestamp do
|
|
6
8
|
describe 'malformed format' do
|
|
7
9
|
it do
|
|
@@ -60,6 +62,44 @@ describe MessagePack::Timestamp do
|
|
|
60
62
|
it 'runs correctly (regression)' do
|
|
61
63
|
expect(factory.unpack(factory.pack(Time.utc(2200)))).to eq(Time.utc(2200))
|
|
62
64
|
end
|
|
65
|
+
|
|
66
|
+
let(:time32_max) { Time.new(2106, 2, 7, 6, 28, 15, "+00:00") }
|
|
67
|
+
it 'is serialized into timestamp32' do
|
|
68
|
+
expect(factory.pack(time32_max).size).to be 6
|
|
69
|
+
expect(factory.unpack(factory.pack(time32_max)).utc).to eq(time32_max)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
let(:time64_min) { Time.new(2106, 2, 7, 6, 28, 16, "+00:00") }
|
|
73
|
+
it 'is serialized into timestamp64' do
|
|
74
|
+
expect(factory.pack(time64_min).size).to be 10
|
|
75
|
+
expect(factory.unpack(factory.pack(time64_min)).utc).to eq(time64_min)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
let(:time64_max) { Time.at(Time.new(2514, 5, 30, 1, 53, 3, "+00:00").to_i, 999999999 / 1000.0r).utc } # TODO: use Time.at(sec, nsec, :nsec) when removing Ruby 2.4 from the list
|
|
79
|
+
it 'is serialized into timestamp64' do
|
|
80
|
+
expect(factory.pack(time64_max).size).to be 10
|
|
81
|
+
expect(factory.unpack(factory.pack(time64_max)).utc).to eq(time64_max)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
let(:time96_positive_min) { Time.new(2514, 5, 30, 1, 53, 4, "+00:00") }
|
|
85
|
+
it 'is serialized into timestamp96' do
|
|
86
|
+
expect(factory.pack(time96_positive_min).size).to be 15
|
|
87
|
+
expect(factory.unpack(factory.pack(time96_positive_min)).utc).to eq(time96_positive_min)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
let(:time96_min) { Time.at(-2**63).utc }
|
|
91
|
+
it 'is serialized into timestamp96' do
|
|
92
|
+
skip if IS_JRUBY # JRuby cannot handle numerics larger than long
|
|
93
|
+
expect(factory.pack(time96_min).size).to be 15
|
|
94
|
+
expect(factory.unpack(factory.pack(time96_min)).utc).to eq(time96_min)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
let(:time96_max) { Time.at(2**63 - 1).utc }
|
|
98
|
+
it 'is serialized into timestamp96' do
|
|
99
|
+
skip if IS_JRUBY # JRuby cannot handle numerics larger than long
|
|
100
|
+
expect(factory.pack(time96_max).size).to be 15
|
|
101
|
+
expect(factory.unpack(factory.pack(time96_max)).utc).to eq(time96_max)
|
|
102
|
+
end
|
|
63
103
|
end
|
|
64
104
|
|
|
65
105
|
describe 'register_type with MessagePack::Timestamp' do
|
data/spec/unpacker_spec.rb
CHANGED
|
@@ -36,6 +36,15 @@ describe MessagePack::Unpacker do
|
|
|
36
36
|
unpacker.each { |obj| hashes = obj }
|
|
37
37
|
expect(hashes[0].keys.first).to equal(hashes[1].keys.first)
|
|
38
38
|
end
|
|
39
|
+
|
|
40
|
+
it 'ensure strings are not deduplicated' do
|
|
41
|
+
sample_data = ["foo"]
|
|
42
|
+
sample_packed = MessagePack.pack(sample_data).force_encoding('ASCII-8BIT')
|
|
43
|
+
unpacker.feed(sample_packed)
|
|
44
|
+
ary = nil
|
|
45
|
+
unpacker.each { |obj| ary = obj }
|
|
46
|
+
expect(ary.first.frozen?).to eq(false)
|
|
47
|
+
end
|
|
39
48
|
end
|
|
40
49
|
|
|
41
50
|
it 'gets IO or object which has #read to read data from it' do
|
|
@@ -635,7 +644,7 @@ describe MessagePack::Unpacker do
|
|
|
635
644
|
MessagePack.unpack(MessagePack.pack(array)).size.should == 10_000
|
|
636
645
|
end
|
|
637
646
|
|
|
638
|
-
it '
|
|
647
|
+
it 'preserves string encoding (issue #200)' do
|
|
639
648
|
string = 'a'.force_encoding(Encoding::UTF_8)
|
|
640
649
|
MessagePack.unpack(MessagePack.pack(string)).encoding.should == string.encoding
|
|
641
650
|
|
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.
|
|
4
|
+
version: 1.4.4
|
|
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:
|
|
13
|
+
date: 2022-01-22 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:
|
|
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:
|
|
56
|
+
version: 1.1.9
|
|
57
57
|
- !ruby/object:Gem::Dependency
|
|
58
58
|
name: rspec
|
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -108,9 +108,9 @@ extensions:
|
|
|
108
108
|
- ext/msgpack/extconf.rb
|
|
109
109
|
extra_rdoc_files: []
|
|
110
110
|
files:
|
|
111
|
+
- ".github/workflows/ci.yaml"
|
|
111
112
|
- ".gitignore"
|
|
112
113
|
- ".rubocop.yml"
|
|
113
|
-
- ".travis.yml"
|
|
114
114
|
- ChangeLog
|
|
115
115
|
- Gemfile
|
|
116
116
|
- LICENSE
|
|
@@ -229,32 +229,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
229
229
|
- !ruby/object:Gem::Version
|
|
230
230
|
version: '0'
|
|
231
231
|
requirements: []
|
|
232
|
-
rubygems_version: 3.
|
|
232
|
+
rubygems_version: 3.3.3
|
|
233
233
|
signing_key:
|
|
234
234
|
specification_version: 4
|
|
235
235
|
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
|
|
236
|
+
test_files: []
|
data/.travis.yml
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
|
|
3
|
-
branches:
|
|
4
|
-
only:
|
|
5
|
-
- master
|
|
6
|
-
|
|
7
|
-
gemfile:
|
|
8
|
-
- Gemfile
|
|
9
|
-
|
|
10
|
-
before_install:
|
|
11
|
-
# This is only for Ruby 2.5.0, Bundler 1.16.1 and rubygems 2.7.3
|
|
12
|
-
# See https://github.com/travis-ci/travis-ci/issues/8969
|
|
13
|
-
- "[ \"x2.7.3\" = \"x\"$(gem --version) ] && gem update --system --no-document || echo \"no need to update rubygem\""
|
|
14
|
-
|
|
15
|
-
# http://rubies.travis-ci.org/
|
|
16
|
-
matrix:
|
|
17
|
-
include:
|
|
18
|
-
- rvm: 2.4.5
|
|
19
|
-
os: linux
|
|
20
|
-
- rvm: 2.5.8
|
|
21
|
-
os: linux
|
|
22
|
-
- rvm: 2.6.6
|
|
23
|
-
os: linux
|
|
24
|
-
- rvm: 2.6.6
|
|
25
|
-
os: osx
|
|
26
|
-
- rvm: 2.7.1
|
|
27
|
-
os: linux
|
|
28
|
-
- rvm: ruby-head
|
|
29
|
-
os: linux
|
|
30
|
-
- rvm: jruby-head
|
|
31
|
-
os: linux
|
|
32
|
-
- rvm: jruby-19mode
|
|
33
|
-
os: linux
|
|
34
|
-
allow_failures:
|
|
35
|
-
- rvm: 2.6.1
|
|
36
|
-
os: osx
|
|
37
|
-
- rvm: ruby-head
|
|
38
|
-
- rvm: jruby-head
|
|
39
|
-
- rvm: jruby-19mode
|