ruby-dbus 0.18.0.beta1 → 0.18.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +15 -0
- data/VERSION +1 -1
- data/doc/Reference.md +1 -1
- data/examples/service/complex-property.rb +21 -0
- data/lib/dbus/data.rb +725 -0
- data/lib/dbus/introspect.rb +1 -0
- data/lib/dbus/marshall.rb +158 -256
- data/lib/dbus/message.rb +4 -10
- data/lib/dbus/object.rb +11 -11
- data/lib/dbus/object_path.rb +2 -1
- data/lib/dbus/raw_message.rb +91 -0
- data/lib/dbus/type.rb +147 -70
- data/lib/dbus.rb +6 -0
- data/spec/data/marshall.yaml +1639 -0
- data/spec/data_spec.rb +298 -0
- data/spec/object_path_spec.rb +1 -0
- data/spec/packet_marshaller_spec.rb +34 -0
- data/spec/packet_unmarshaller_spec.rb +262 -0
- data/spec/property_spec.rb +24 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/type_spec.rb +67 -6
- metadata +9 -2
data/spec/type_spec.rb
CHANGED
@@ -6,15 +6,76 @@ require "dbus"
|
|
6
6
|
|
7
7
|
describe DBus do
|
8
8
|
describe ".type" do
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
good = [
|
10
|
+
"i",
|
11
|
+
"ai",
|
12
|
+
"a(ii)",
|
13
|
+
"aai"
|
14
|
+
]
|
15
|
+
|
16
|
+
context "valid single types" do
|
17
|
+
good.each do |s|
|
18
|
+
it "#{s.inspect} is parsed" do
|
19
|
+
expect(DBus.type(s).to_s).to eq(s)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
bad = [
|
25
|
+
["\x00", "Unknown type code"],
|
26
|
+
["!", "Unknown type code"],
|
27
|
+
|
28
|
+
# ARRAY related
|
29
|
+
["a", "Empty ARRAY"],
|
30
|
+
["aa", "Empty ARRAY"],
|
31
|
+
|
32
|
+
# STRUCT related
|
33
|
+
["r", "Abstract STRUCT"],
|
34
|
+
["()", "Empty STRUCT"],
|
35
|
+
["(ii", "STRUCT not closed"],
|
36
|
+
["a{i)", "STRUCT unexpectedly closed"],
|
37
|
+
|
38
|
+
# TODO: deep nesting arrays, structs, combined
|
39
|
+
|
40
|
+
# DICT_ENTRY related
|
41
|
+
["e", "Abstract DICT_ENTRY"],
|
42
|
+
["a{}", "DICT_ENTRY must have 2 subtypes, found 0"],
|
43
|
+
["a{s}", "DICT_ENTRY must have 2 subtypes, found 1"],
|
44
|
+
["a{sss}", "DICT_ENTRY must have 2 subtypes, found 3"],
|
45
|
+
["a{vs}", "DICT_ENTRY key must be basic (non-container)"],
|
46
|
+
["{sv}", "DICT_ENTRY not an immediate child of an ARRAY"],
|
47
|
+
["a({sv})", "DICT_ENTRY not an immediate child of an ARRAY"],
|
48
|
+
["a{sv", "DICT_ENTRY not closed"],
|
49
|
+
["}", "DICT_ENTRY unexpectedly closed"],
|
50
|
+
|
51
|
+
# Too long
|
52
|
+
["(#{"y" * 254})", "longer than 255"],
|
53
|
+
|
54
|
+
# not Single Complete Types
|
55
|
+
["", "expecting a Single Complete Type"],
|
56
|
+
["ii", "more than a Single Complete Type"]
|
57
|
+
]
|
58
|
+
context "invalid single types" do
|
59
|
+
bad.each.each do |s, msg|
|
60
|
+
it "#{s.inspect} raises an exception mentioning: #{msg}" do
|
61
|
+
rx = Regexp.new(Regexp.quote(msg))
|
62
|
+
expect { DBus.type(s) }.to raise_error(DBus::Type::SignatureException, rx)
|
63
|
+
end
|
12
64
|
end
|
13
65
|
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe ".types" do
|
69
|
+
good = [
|
70
|
+
"",
|
71
|
+
"ii"
|
72
|
+
]
|
14
73
|
|
15
|
-
|
16
|
-
|
17
|
-
|
74
|
+
context "valid signatures" do
|
75
|
+
good.each do |s|
|
76
|
+
it "#{s.inspect} is parsed" do
|
77
|
+
expect(DBus.types(s).map(&:to_s).join).to eq(s)
|
78
|
+
end
|
18
79
|
end
|
19
80
|
end
|
20
81
|
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.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruby DBus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rexml
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- examples/no-introspect/tracker-test.rb
|
132
132
|
- examples/rhythmbox/playpause.rb
|
133
133
|
- examples/service/call_service.rb
|
134
|
+
- examples/service/complex-property.rb
|
134
135
|
- examples/service/service_newapi.rb
|
135
136
|
- examples/simple/call_introspect.rb
|
136
137
|
- examples/simple/get_id.rb
|
@@ -144,6 +145,7 @@ files:
|
|
144
145
|
- lib/dbus/bus_name.rb
|
145
146
|
- lib/dbus/core_ext/class/attribute.rb
|
146
147
|
- lib/dbus/core_ext/module/redefine_method.rb
|
148
|
+
- lib/dbus/data.rb
|
147
149
|
- lib/dbus/error.rb
|
148
150
|
- lib/dbus/introspect.rb
|
149
151
|
- lib/dbus/logger.rb
|
@@ -156,6 +158,7 @@ files:
|
|
156
158
|
- lib/dbus/proxy_object.rb
|
157
159
|
- lib/dbus/proxy_object_factory.rb
|
158
160
|
- lib/dbus/proxy_object_interface.rb
|
161
|
+
- lib/dbus/raw_message.rb
|
159
162
|
- lib/dbus/type.rb
|
160
163
|
- lib/dbus/xml.rb
|
161
164
|
- ruby-dbus.gemspec
|
@@ -167,12 +170,16 @@ files:
|
|
167
170
|
- spec/bus_spec.rb
|
168
171
|
- spec/byte_array_spec.rb
|
169
172
|
- spec/client_robustness_spec.rb
|
173
|
+
- spec/data/marshall.yaml
|
174
|
+
- spec/data_spec.rb
|
170
175
|
- spec/err_msg_spec.rb
|
171
176
|
- spec/introspect_xml_parser_spec.rb
|
172
177
|
- spec/introspection_spec.rb
|
173
178
|
- spec/main_loop_spec.rb
|
174
179
|
- spec/node_spec.rb
|
175
180
|
- spec/object_path_spec.rb
|
181
|
+
- spec/packet_marshaller_spec.rb
|
182
|
+
- spec/packet_unmarshaller_spec.rb
|
176
183
|
- spec/property_spec.rb
|
177
184
|
- spec/proxy_object_spec.rb
|
178
185
|
- spec/server_robustness_spec.rb
|