msgpack 1.4.2 → 1.4.3

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.
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
@@ -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
@@ -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 'preserve string encoding (issue #200)' do
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.2
4
+ version: 1.4.3
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: 2021-02-01 00:00:00.000000000 Z
13
+ date: 2022-01-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -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,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  - !ruby/object:Gem::Version
230
230
  version: '0'
231
231
  requirements: []
232
- rubygems_version: 3.2.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.
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