ruby-dbus 0.18.0.beta3 → 0.18.0.beta6
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/NEWS.md +38 -0
- data/VERSION +1 -1
- data/lib/dbus/data.rb +201 -158
- data/lib/dbus/marshall.rb +23 -8
- data/lib/dbus/type.rb +144 -15
- data/spec/data/marshall.yaml +28 -0
- data/spec/data_spec.rb +328 -44
- data/spec/packet_marshaller_spec.rb +7 -0
- data/spec/packet_unmarshaller_spec.rb +2 -16
- data/spec/property_spec.rb +48 -2
- data/spec/service_newapi.rb +4 -4
- data/spec/type_spec.rb +145 -0
- metadata +6 -7
data/spec/type_spec.rb
CHANGED
@@ -45,6 +45,7 @@ describe DBus do
|
|
45
45
|
["a{vs}", "DICT_ENTRY key must be basic (non-container)"],
|
46
46
|
["{sv}", "DICT_ENTRY not an immediate child of an ARRAY"],
|
47
47
|
["a({sv})", "DICT_ENTRY not an immediate child of an ARRAY"],
|
48
|
+
["a{s", "DICT_ENTRY not closed"],
|
48
49
|
["a{sv", "DICT_ENTRY not closed"],
|
49
50
|
["}", "DICT_ENTRY unexpectedly closed"],
|
50
51
|
|
@@ -79,4 +80,148 @@ describe DBus do
|
|
79
80
|
end
|
80
81
|
end
|
81
82
|
end
|
83
|
+
|
84
|
+
describe DBus::Type do
|
85
|
+
let(:as1) { DBus.type("as") }
|
86
|
+
let(:as2) { DBus.type("as") }
|
87
|
+
let(:aas) { DBus.type("aas") }
|
88
|
+
|
89
|
+
describe "#==" do
|
90
|
+
it "is true for same types" do
|
91
|
+
expect(as1).to eq(as2)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "is true for a type and its string representation" do
|
95
|
+
expect(as1).to eq("as")
|
96
|
+
end
|
97
|
+
|
98
|
+
it "is false for different types" do
|
99
|
+
expect(as1).to_not eq(aas)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "is false for a type and a different string" do
|
103
|
+
expect(as1).to_not eq("aas")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe "#eql?" do
|
108
|
+
it "is true for same types" do
|
109
|
+
expect(as1).to eql(as2)
|
110
|
+
end
|
111
|
+
|
112
|
+
it "is false for a type and its string representation" do
|
113
|
+
expect(as1).to_not eql("as")
|
114
|
+
end
|
115
|
+
|
116
|
+
it "is false for different types" do
|
117
|
+
expect(as1).to_not eql(aas)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "is false for a type and a different string" do
|
121
|
+
expect(as1).to_not eql("aas")
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe "#<<" do
|
126
|
+
it "raises if the argument is not a Type" do
|
127
|
+
t = DBus::Type.new(DBus::Type::ARRAY)
|
128
|
+
expect { t << "s" }.to raise_error(ArgumentError)
|
129
|
+
end
|
130
|
+
|
131
|
+
# TODO: the following raise checks do not occur in practice, as there are
|
132
|
+
# parallel checks in the parses. The code could be simplified?
|
133
|
+
it "raises if adding too much to an array" do
|
134
|
+
t = DBus::Type.new(DBus::Type::ARRAY)
|
135
|
+
b = DBus::Type.new(DBus::Type::BOOLEAN)
|
136
|
+
t << b
|
137
|
+
expect { t << b }.to raise_error(DBus::Type::SignatureException)
|
138
|
+
end
|
139
|
+
|
140
|
+
it "raises if adding too much to a dict_entry" do
|
141
|
+
t = DBus::Type.new(DBus::Type::DICT_ENTRY, abstract: true)
|
142
|
+
b = DBus::Type.new(DBus::Type::BOOLEAN)
|
143
|
+
t << b
|
144
|
+
t << b
|
145
|
+
expect { t << b }.to raise_error(DBus::Type::SignatureException)
|
146
|
+
end
|
147
|
+
|
148
|
+
it "raises if adding to a non-container" do
|
149
|
+
t = DBus::Type.new(DBus::Type::STRING)
|
150
|
+
b = DBus::Type.new(DBus::Type::BOOLEAN)
|
151
|
+
expect { t << b }.to raise_error(DBus::Type::SignatureException)
|
152
|
+
|
153
|
+
t = DBus::Type.new(DBus::Type::VARIANT)
|
154
|
+
expect { t << b }.to raise_error(DBus::Type::SignatureException)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe DBus::Type::Array do
|
159
|
+
describe ".[]" do
|
160
|
+
it "takes Type argument" do
|
161
|
+
t = DBus::Type::Array[DBus::Type.new("s")]
|
162
|
+
expect(t.to_s).to eq "as"
|
163
|
+
end
|
164
|
+
|
165
|
+
it "takes 's':String argument" do
|
166
|
+
t = DBus::Type::Array["s"]
|
167
|
+
expect(t.to_s).to eq "as"
|
168
|
+
end
|
169
|
+
|
170
|
+
it "takes String:Class argument" do
|
171
|
+
t = DBus::Type::Array[String]
|
172
|
+
expect(t.to_s).to eq "as"
|
173
|
+
end
|
174
|
+
|
175
|
+
it "rejects Integer:Class argument" do
|
176
|
+
expect { DBus::Type::Array[Integer] }.to raise_error(ArgumentError)
|
177
|
+
end
|
178
|
+
|
179
|
+
it "rejects /./:Regexp argument" do
|
180
|
+
expect { DBus::Type::Array[/./] }.to raise_error(ArgumentError)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
describe DBus::Type::Hash do
|
186
|
+
describe ".[]" do
|
187
|
+
it "takes Type arguments" do
|
188
|
+
t = DBus::Type::Hash[DBus::Type.new("s"), DBus::Type.new("v")]
|
189
|
+
expect(t.to_s).to eq "a{sv}"
|
190
|
+
end
|
191
|
+
|
192
|
+
it "takes 's':String arguments" do
|
193
|
+
t = DBus::Type::Hash["s", "v"]
|
194
|
+
expect(t.to_s).to eq "a{sv}"
|
195
|
+
end
|
196
|
+
|
197
|
+
it "takes String:Class argument" do
|
198
|
+
t = DBus::Type::Hash[String, DBus::Type::VARIANT]
|
199
|
+
expect(t.to_s).to eq "a{sv}"
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
describe DBus::Type::Struct do
|
205
|
+
describe ".[]" do
|
206
|
+
it "takes Type arguments" do
|
207
|
+
t = DBus::Type::Struct[DBus::Type.new("s"), DBus::Type.new("v")]
|
208
|
+
expect(t.to_s).to eq "(sv)"
|
209
|
+
end
|
210
|
+
|
211
|
+
it "takes 's':String arguments" do
|
212
|
+
t = DBus::Type::Struct["s", "v"]
|
213
|
+
expect(t.to_s).to eq "(sv)"
|
214
|
+
end
|
215
|
+
|
216
|
+
it "takes String:Class argument" do
|
217
|
+
t = DBus::Type::Struct[String, DBus::Type::VARIANT]
|
218
|
+
expect(t.to_s).to eq "(sv)"
|
219
|
+
end
|
220
|
+
|
221
|
+
it "raises on no arguments" do
|
222
|
+
expect { DBus::Type::Struct[] }.to raise_error(ArgumentError)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
82
227
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-dbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.0.
|
4
|
+
version: 0.18.0.beta6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruby DBus Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rexml
|
@@ -202,7 +202,7 @@ homepage: https://github.com/mvidner/ruby-dbus
|
|
202
202
|
licenses:
|
203
203
|
- LGPL-2.1
|
204
204
|
metadata: {}
|
205
|
-
post_install_message:
|
205
|
+
post_install_message:
|
206
206
|
rdoc_options: []
|
207
207
|
require_paths:
|
208
208
|
- lib
|
@@ -217,9 +217,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
217
|
- !ruby/object:Gem::Version
|
218
218
|
version: 1.3.1
|
219
219
|
requirements: []
|
220
|
-
|
221
|
-
|
222
|
-
signing_key:
|
220
|
+
rubygems_version: 3.3.0.dev
|
221
|
+
signing_key:
|
223
222
|
specification_version: 4
|
224
223
|
summary: Ruby module for interaction with D-Bus
|
225
224
|
test_files: []
|