google-protobuf 3.4.1.1-x86-linux → 3.5.0-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of google-protobuf might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/defs.c +14 -3
- data/ext/google/protobuf_c/encode_decode.c +72 -59
- data/ext/google/protobuf_c/message.c +42 -7
- data/ext/google/protobuf_c/protobuf.c +1 -1
- data/ext/google/protobuf_c/protobuf.h +14 -5
- data/ext/google/protobuf_c/storage.c +12 -1
- data/ext/google/protobuf_c/upb.c +1413 -411
- data/ext/google/protobuf_c/upb.h +508 -411
- data/lib/google/2.0/protobuf_c.so +0 -0
- data/lib/google/2.1/protobuf_c.so +0 -0
- data/lib/google/2.2/protobuf_c.so +0 -0
- data/lib/google/2.3/protobuf_c.so +0 -0
- data/lib/google/2.4/protobuf_c.so +0 -0
- data/tests/basic.rb +50 -3
- metadata +2 -2
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/tests/basic.rb
CHANGED
@@ -51,6 +51,17 @@ module BasicTest
|
|
51
51
|
optional :foo, :int32, 1
|
52
52
|
end
|
53
53
|
|
54
|
+
add_message "TestEmbeddedMessageParent" do
|
55
|
+
optional :child_msg, :message, 1, "TestEmbeddedMessageChild"
|
56
|
+
optional :number, :int32, 2
|
57
|
+
|
58
|
+
repeated :repeated_msg, :message, 3, "TestEmbeddedMessageChild"
|
59
|
+
repeated :repeated_number, :int32, 4
|
60
|
+
end
|
61
|
+
add_message "TestEmbeddedMessageChild" do
|
62
|
+
optional :sub_child, :message, 1, "TestMessage"
|
63
|
+
end
|
64
|
+
|
54
65
|
add_message "Recursive1" do
|
55
66
|
optional :foo, :message, 1, "Recursive2"
|
56
67
|
end
|
@@ -113,6 +124,8 @@ module BasicTest
|
|
113
124
|
Baz = pool.lookup("Baz").msgclass
|
114
125
|
TestMessage = pool.lookup("TestMessage").msgclass
|
115
126
|
TestMessage2 = pool.lookup("TestMessage2").msgclass
|
127
|
+
TestEmbeddedMessageParent = pool.lookup("TestEmbeddedMessageParent").msgclass
|
128
|
+
TestEmbeddedMessageChild = pool.lookup("TestEmbeddedMessageChild").msgclass
|
116
129
|
Recursive1 = pool.lookup("Recursive1").msgclass
|
117
130
|
Recursive2 = pool.lookup("Recursive2").msgclass
|
118
131
|
TestEnum = pool.lookup("TestEnum").enummodule
|
@@ -161,12 +174,18 @@ module BasicTest
|
|
161
174
|
m.optional_double = 0.5
|
162
175
|
m.optional_string = "hello"
|
163
176
|
assert m.optional_string == "hello"
|
177
|
+
m.optional_string = :hello
|
178
|
+
assert m.optional_string == "hello"
|
164
179
|
m.optional_bytes = "world".encode!('ASCII-8BIT')
|
165
180
|
assert m.optional_bytes == "world"
|
166
181
|
m.optional_msg = TestMessage2.new(:foo => 42)
|
167
182
|
assert m.optional_msg == TestMessage2.new(:foo => 42)
|
168
183
|
m.optional_msg = nil
|
169
184
|
assert m.optional_msg == nil
|
185
|
+
m.optional_enum = :C
|
186
|
+
assert m.optional_enum == :C
|
187
|
+
m.optional_enum = 'C'
|
188
|
+
assert m.optional_enum == :C
|
170
189
|
end
|
171
190
|
|
172
191
|
def test_ctor_args
|
@@ -183,6 +202,34 @@ module BasicTest
|
|
183
202
|
assert m.repeated_string[2] == "world"
|
184
203
|
end
|
185
204
|
|
205
|
+
def test_ctor_string_symbol_args
|
206
|
+
m = TestMessage.new(:optional_enum => 'C', :repeated_enum => ['A', 'B'])
|
207
|
+
assert_equal :C, m.optional_enum
|
208
|
+
assert_equal [:A, :B], m.repeated_enum
|
209
|
+
|
210
|
+
m = TestMessage.new(:optional_string => :foo, :repeated_string => [:foo, :bar])
|
211
|
+
assert_equal 'foo', m.optional_string
|
212
|
+
assert_equal ['foo', 'bar'], m.repeated_string
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_embeddedmsg_hash_init
|
216
|
+
m = TestEmbeddedMessageParent.new(:child_msg => {sub_child: {optional_int32: 1}},
|
217
|
+
:number => 2,
|
218
|
+
:repeated_msg => [{sub_child: {optional_int32: 3}}],
|
219
|
+
:repeated_number => [10, 20, 30])
|
220
|
+
|
221
|
+
assert_equal 2, m.number
|
222
|
+
assert_equal [10, 20, 30], m.repeated_number
|
223
|
+
|
224
|
+
assert_not_nil m.child_msg
|
225
|
+
assert_not_nil m.child_msg.sub_child
|
226
|
+
assert_equal m.child_msg.sub_child.optional_int32, 1
|
227
|
+
|
228
|
+
assert_not_nil m.repeated_msg
|
229
|
+
assert_equal 1, m.repeated_msg.length
|
230
|
+
assert_equal 3, m.repeated_msg.first.sub_child.optional_int32
|
231
|
+
end
|
232
|
+
|
186
233
|
def test_inspect
|
187
234
|
m = TestMessage.new(:optional_int32 => -42,
|
188
235
|
:optional_enum => :A,
|
@@ -614,7 +661,7 @@ module BasicTest
|
|
614
661
|
assert_raise RangeError do
|
615
662
|
m["z"] = :Z
|
616
663
|
end
|
617
|
-
assert_raise
|
664
|
+
assert_raise RangeError do
|
618
665
|
m["z"] = "z"
|
619
666
|
end
|
620
667
|
end
|
@@ -927,7 +974,7 @@ module BasicTest
|
|
927
974
|
end
|
928
975
|
|
929
976
|
def test_to_h
|
930
|
-
m = TestMessage.new(:optional_bool => true, :optional_double => -10.100001, :optional_string => 'foo', :repeated_string => ['bar1', 'bar2'])
|
977
|
+
m = TestMessage.new(:optional_bool => true, :optional_double => -10.100001, :optional_string => 'foo', :repeated_string => ['bar1', 'bar2'], :repeated_msg => [TestMessage2.new(:foo => 100)])
|
931
978
|
expected_result = {
|
932
979
|
:optional_bool=>true,
|
933
980
|
:optional_bytes=>"",
|
@@ -947,7 +994,7 @@ module BasicTest
|
|
947
994
|
:repeated_float=>[],
|
948
995
|
:repeated_int32=>[],
|
949
996
|
:repeated_int64=>[],
|
950
|
-
:repeated_msg=>[],
|
997
|
+
:repeated_msg=>[{:foo => 100}],
|
951
998
|
:repeated_string=>["bar1", "bar2"],
|
952
999
|
:repeated_uint32=>[],
|
953
1000
|
:repeated_uint64=>[]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: x86-linux
|
6
6
|
authors:
|
7
7
|
- Protobuf Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler-dock
|