google-protobuf 3.11.4 → 3.12.0.rc.1

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.

File without changes
@@ -32,11 +32,11 @@ module BasicTest
32
32
  include CommonTests
33
33
 
34
34
  def test_has_field
35
- m = TestMessage.new
36
- assert !m.has_optional_msg?
37
- m.optional_msg = TestMessage2.new
38
- assert m.has_optional_msg?
39
- assert TestMessage.descriptor.lookup('optional_msg').has?(m)
35
+ m = TestSingularFields.new
36
+ assert !m.has_singular_msg?
37
+ m.singular_msg = TestMessage2.new
38
+ assert m.has_singular_msg?
39
+ assert TestSingularFields.descriptor.lookup('singular_msg').has?(m)
40
40
 
41
41
  m = OneofMessage.new
42
42
  assert !m.has_my_oneof?
@@ -45,32 +45,31 @@ module BasicTest
45
45
  assert_raise NoMethodError do
46
46
  m.has_a?
47
47
  end
48
- assert_raise ArgumentError do
49
- OneofMessage.descriptor.lookup('a').has?(m)
50
- end
48
+ assert_true OneofMessage.descriptor.lookup('a').has?(m)
51
49
 
52
- m = TestMessage.new
50
+ m = TestSingularFields.new
53
51
  assert_raise NoMethodError do
54
- m.has_optional_int32?
52
+ m.has_singular_int32?
55
53
  end
56
54
  assert_raise ArgumentError do
57
- TestMessage.descriptor.lookup('optional_int32').has?(m)
55
+ TestSingularFields.descriptor.lookup('singular_int32').has?(m)
58
56
  end
59
57
 
60
58
  assert_raise NoMethodError do
61
- m.has_optional_string?
59
+ m.has_singular_string?
62
60
  end
63
61
  assert_raise ArgumentError do
64
- TestMessage.descriptor.lookup('optional_string').has?(m)
62
+ TestSingularFields.descriptor.lookup('singular_string').has?(m)
65
63
  end
66
64
 
67
65
  assert_raise NoMethodError do
68
- m.has_optional_bool?
66
+ m.has_singular_bool?
69
67
  end
70
68
  assert_raise ArgumentError do
71
- TestMessage.descriptor.lookup('optional_bool').has?(m)
69
+ TestSingularFields.descriptor.lookup('singular_bool').has?(m)
72
70
  end
73
71
 
72
+ m = TestMessage.new
74
73
  assert_raise NoMethodError do
75
74
  m.has_repeated_msg?
76
75
  end
@@ -79,40 +78,59 @@ module BasicTest
79
78
  end
80
79
  end
81
80
 
81
+ def test_no_presence
82
+ m = TestSingularFields.new
83
+
84
+ # Explicitly setting to zero does not cause anything to be serialized.
85
+ m.singular_int32 = 0
86
+ assert_equal "", TestSingularFields.encode(m)
87
+
88
+ # Explicitly setting to a non-zero value *does* cause serialization.
89
+ m.singular_int32 = 1
90
+ assert_not_equal "", TestSingularFields.encode(m)
91
+
92
+ m.singular_int32 = 0
93
+ assert_equal "", TestSingularFields.encode(m)
94
+ end
95
+
82
96
  def test_set_clear_defaults
83
- m = TestMessage.new
97
+ m = TestSingularFields.new
98
+
99
+ m.singular_int32 = -42
100
+ assert_equal -42, m.singular_int32
101
+ m.clear_singular_int32
102
+ assert_equal 0, m.singular_int32
103
+
104
+ m.singular_int32 = 50
105
+ assert_equal 50, m.singular_int32
106
+ TestSingularFields.descriptor.lookup('singular_int32').clear(m)
107
+ assert_equal 0, m.singular_int32
108
+
109
+ m.singular_string = "foo bar"
110
+ assert_equal "foo bar", m.singular_string
111
+ m.clear_singular_string
112
+ assert_equal "", m.singular_string
113
+
114
+ m.singular_string = "foo"
115
+ assert_equal "foo", m.singular_string
116
+ TestSingularFields.descriptor.lookup('singular_string').clear(m)
117
+ assert_equal "", m.singular_string
118
+
119
+ m.singular_msg = TestMessage2.new(:foo => 42)
120
+ assert_equal TestMessage2.new(:foo => 42), m.singular_msg
121
+ assert m.has_singular_msg?
122
+ m.clear_singular_msg
123
+ assert_equal nil, m.singular_msg
124
+ assert !m.has_singular_msg?
125
+
126
+ m.singular_msg = TestMessage2.new(:foo => 42)
127
+ assert_equal TestMessage2.new(:foo => 42), m.singular_msg
128
+ TestSingularFields.descriptor.lookup('singular_msg').clear(m)
129
+ assert_equal nil, m.singular_msg
130
+ end
84
131
 
85
- m.optional_int32 = -42
86
- assert_equal -42, m.optional_int32
87
- m.clear_optional_int32
88
- assert_equal 0, m.optional_int32
89
-
90
- m.optional_int32 = 50
91
- assert_equal 50, m.optional_int32
92
- TestMessage.descriptor.lookup('optional_int32').clear(m)
93
- assert_equal 0, m.optional_int32
94
-
95
- m.optional_string = "foo bar"
96
- assert_equal "foo bar", m.optional_string
97
- m.clear_optional_string
98
- assert_equal "", m.optional_string
99
-
100
- m.optional_string = "foo"
101
- assert_equal "foo", m.optional_string
102
- TestMessage.descriptor.lookup('optional_string').clear(m)
103
- assert_equal "", m.optional_string
104
-
105
- m.optional_msg = TestMessage2.new(:foo => 42)
106
- assert_equal TestMessage2.new(:foo => 42), m.optional_msg
107
- assert m.has_optional_msg?
108
- m.clear_optional_msg
109
- assert_equal nil, m.optional_msg
110
- assert !m.has_optional_msg?
111
-
112
- m.optional_msg = TestMessage2.new(:foo => 42)
113
- assert_equal TestMessage2.new(:foo => 42), m.optional_msg
114
- TestMessage.descriptor.lookup('optional_msg').clear(m)
115
- assert_equal nil, m.optional_msg
132
+ def test_clear_repeated_fields
133
+ m = TestMessage.new
116
134
 
117
135
  m.repeated_int32.push(1)
118
136
  assert_equal [1], m.repeated_int32
@@ -128,6 +146,7 @@ module BasicTest
128
146
  m.a = "foo"
129
147
  assert_equal "foo", m.a
130
148
  assert m.has_my_oneof?
149
+ assert_equal :a, m.my_oneof
131
150
  m.clear_a
132
151
  assert !m.has_my_oneof?
133
152
 
@@ -143,7 +162,6 @@ module BasicTest
143
162
  assert !m.has_my_oneof?
144
163
  end
145
164
 
146
-
147
165
  def test_initialization_map_errors
148
166
  e = assert_raise ArgumentError do
149
167
  TestMessage.new(:hello => "world")
File without changes
File without changes
metadata CHANGED
@@ -1,43 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.4
4
+ version: 3.12.0.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Protobuf Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-14 00:00:00.000000000 Z
11
+ date: 2020-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler-dock
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.0
19
+ version: 1.0.1
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.1
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 0.6.0
32
+ version: '2.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rake-compiler
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: 0.9.5
39
+ version: 1.1.0
34
40
  type: :development
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: 0.9.5
46
+ version: 1.1.0
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: test-unit
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -112,7 +118,7 @@ homepage: https://developers.google.com/protocol-buffers
112
118
  licenses:
113
119
  - BSD-3-Clause
114
120
  metadata:
115
- source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.11.4/ruby
121
+ source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.12.0-rc1/ruby
116
122
  post_install_message:
117
123
  rdoc_options: []
118
124
  require_paths:
@@ -124,9 +130,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
130
  version: '2.3'
125
131
  required_rubygems_version: !ruby/object:Gem::Requirement
126
132
  requirements:
127
- - - ">="
133
+ - - ">"
128
134
  - !ruby/object:Gem::Version
129
- version: '0'
135
+ version: 1.3.1
130
136
  requirements: []
131
137
  rubygems_version: 3.1.2
132
138
  signing_key: