msgpack 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +6 -0
  3. data/ext/java/org/msgpack/jruby/ExtensionRegistry.java +4 -9
  4. data/ext/msgpack/buffer_class.c +4 -4
  5. data/ext/msgpack/extconf.rb +3 -1
  6. data/ext/msgpack/packer.c +1 -0
  7. data/ext/msgpack/packer_class.c +5 -19
  8. data/ext/msgpack/rbinit.c +1 -1
  9. data/ext/msgpack/unpacker.c +1 -0
  10. data/ext/msgpack/unpacker_class.c +5 -7
  11. data/lib/msgpack/buffer.rb +9 -0
  12. data/lib/msgpack/packer.rb +4 -0
  13. data/lib/msgpack/unpacker.rb +4 -0
  14. data/lib/msgpack/version.rb +1 -1
  15. data/lib/msgpack.rb +1 -0
  16. data/msgpack.gemspec +5 -2
  17. metadata +18 -47
  18. data/.github/workflows/ci.yaml +0 -57
  19. data/.gitignore +0 -23
  20. data/.rubocop.yml +0 -36
  21. data/Gemfile +0 -9
  22. data/Rakefile +0 -70
  23. data/appveyor.yml +0 -18
  24. data/bench/bench.rb +0 -78
  25. data/bin/console +0 -8
  26. data/doclib/msgpack/buffer.rb +0 -193
  27. data/doclib/msgpack/core_ext.rb +0 -101
  28. data/doclib/msgpack/error.rb +0 -19
  29. data/doclib/msgpack/extension_value.rb +0 -9
  30. data/doclib/msgpack/factory.rb +0 -145
  31. data/doclib/msgpack/packer.rb +0 -209
  32. data/doclib/msgpack/time.rb +0 -22
  33. data/doclib/msgpack/timestamp.rb +0 -44
  34. data/doclib/msgpack/unpacker.rb +0 -183
  35. data/doclib/msgpack.rb +0 -87
  36. data/msgpack.org.md +0 -46
  37. data/spec/bigint_spec.rb +0 -26
  38. data/spec/cases.json +0 -1
  39. data/spec/cases.msg +0 -0
  40. data/spec/cases_compact.msg +0 -0
  41. data/spec/cases_spec.rb +0 -39
  42. data/spec/cruby/buffer_io_spec.rb +0 -255
  43. data/spec/cruby/buffer_packer.rb +0 -29
  44. data/spec/cruby/buffer_spec.rb +0 -592
  45. data/spec/cruby/buffer_unpacker.rb +0 -19
  46. data/spec/cruby/unpacker_spec.rb +0 -70
  47. data/spec/ext_value_spec.rb +0 -99
  48. data/spec/exttypes.rb +0 -51
  49. data/spec/factory_spec.rb +0 -706
  50. data/spec/format_spec.rb +0 -301
  51. data/spec/jruby/benchmarks/shootout_bm.rb +0 -73
  52. data/spec/jruby/benchmarks/symbolize_keys_bm.rb +0 -25
  53. data/spec/jruby/unpacker_spec.rb +0 -186
  54. data/spec/msgpack_spec.rb +0 -214
  55. data/spec/pack_spec.rb +0 -61
  56. data/spec/packer_spec.rb +0 -575
  57. data/spec/random_compat.rb +0 -24
  58. data/spec/spec_helper.rb +0 -72
  59. data/spec/timestamp_spec.rb +0 -159
  60. data/spec/unpack_spec.rb +0 -57
  61. data/spec/unpacker_spec.rb +0 -869
@@ -1,99 +0,0 @@
1
- # encoding: ascii-8bit
2
- require 'spec_helper'
3
-
4
- describe MessagePack::ExtensionValue do
5
- subject do
6
- described_class.new(1, "data")
7
- end
8
-
9
- describe '#type/#type=' do
10
- it 'returns value set by #initialize' do
11
- subject.type.should == 1
12
- end
13
-
14
- it 'assigns a value' do
15
- subject.type = 2
16
- subject.type.should == 2
17
- end
18
- end
19
-
20
- describe '#payload/#payload=' do
21
- it 'returns value set by #initialize' do
22
- subject.payload.should == "data"
23
- end
24
-
25
- it 'assigns a value' do
26
- subject.payload = "a"
27
- subject.payload.should == "a"
28
- end
29
- end
30
-
31
- describe '#==/#eql?/#hash' do
32
- it 'returns equivalent if the content is same' do
33
- ext1 = MessagePack::ExtensionValue.new(1, "data")
34
- ext2 = MessagePack::ExtensionValue.new(1, "data")
35
- (ext1 == ext2).should be true
36
- ext1.eql?(ext2).should be true
37
- (ext1.hash == ext2.hash).should be true
38
- end
39
-
40
- it 'returns not equivalent if type is not same' do
41
- ext1 = MessagePack::ExtensionValue.new(1, "data")
42
- ext2 = MessagePack::ExtensionValue.new(2, "data")
43
- (ext1 == ext2).should be false
44
- ext1.eql?(ext2).should be false
45
- (ext1.hash == ext2.hash).should be false
46
- end
47
-
48
- it 'returns not equivalent if payload is not same' do
49
- ext1 = MessagePack::ExtensionValue.new(1, "data")
50
- ext2 = MessagePack::ExtensionValue.new(1, "value")
51
- (ext1 == ext2).should be false
52
- ext1.eql?(ext2).should be false
53
- (ext1.hash == ext2.hash).should be false
54
- end
55
- end
56
-
57
- describe '#to_msgpack' do
58
- it 'serializes very short payload' do
59
- ext = MessagePack::ExtensionValue.new(1, "a"*2).to_msgpack
60
- ext.should == "\xd5\x01" + "a"*2
61
- end
62
-
63
- it 'serializes short payload' do
64
- ext = MessagePack::ExtensionValue.new(1, "a"*18).to_msgpack
65
- ext.should == "\xc7\x12\x01" + "a"*18
66
- end
67
-
68
- it 'serializes long payload' do
69
- ext = MessagePack::ExtensionValue.new(1, "a"*65540).to_msgpack
70
- ext.should == "\xc9\x00\x01\x00\x04\x01" + "a"*65540
71
- end
72
-
73
- it 'with a packer serializes to a packer' do
74
- ext = MessagePack::ExtensionValue.new(1, "aa")
75
- packer = MessagePack::Packer.new
76
- ext.to_msgpack(packer)
77
- packer.buffer.to_s.should == "\xd5\x01aa"
78
- end
79
-
80
- [-129, -65540, -(2**40), 128, 65540, 2**40].each do |type|
81
- context "with invalid type (#{type})" do
82
- it 'raises RangeError' do
83
- lambda { MessagePack::ExtensionValue.new(type, "a").to_msgpack }.should raise_error(RangeError)
84
- end
85
- end
86
- end
87
- end
88
-
89
- describe '#dup' do
90
- it 'duplicates' do
91
- ext1 = MessagePack::ExtensionValue.new(1, "data")
92
- ext2 = ext1.dup
93
- ext2.type = 2
94
- ext2.payload = "data2"
95
- ext1.type.should == 1
96
- ext1.payload.should == "data"
97
- end
98
- end
99
- end
data/spec/exttypes.rb DELETED
@@ -1,51 +0,0 @@
1
- class DummyTimeStamp1
2
- TYPE = 15
3
-
4
- attr_reader :utime, :usec, :time
5
-
6
- def initialize(utime, usec)
7
- @utime = utime
8
- @usec = usec
9
- @time = Time.at(utime, usec)
10
- end
11
-
12
- def ==(other)
13
- self.utime == other.utime && self.usec == other.usec
14
- end
15
-
16
- def self.type_id
17
- 15
18
- end
19
-
20
- def self.from_msgpack_ext(data)
21
- new(*data.unpack('I*'))
22
- end
23
-
24
- def to_msgpack_ext
25
- [@utime,@usec].pack('I*')
26
- end
27
- end
28
-
29
- class DummyTimeStamp2
30
- TYPE = 16
31
-
32
- attr_reader :utime, :usec, :time
33
-
34
- def initialize(utime, usec)
35
- @utime = utime
36
- @usec = usec
37
- @time = Time.at(utime, usec)
38
- end
39
-
40
- def ==(other)
41
- self.utime == other.utime && self.usec == other.usec
42
- end
43
-
44
- def self.deserialize(data)
45
- new(* data.split(',', 2).map(&:to_i))
46
- end
47
-
48
- def serialize
49
- [@utime,@usec].map(&:to_s).join(',')
50
- end
51
- end