File: introspect_xml_parser_spec.rb

package info (click to toggle)
ruby-dbus 0.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 520 kB
  • sloc: ruby: 3,786; sh: 53; makefile: 8
file content (26 lines) | stat: -rwxr-xr-x 667 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env rspec
require_relative "spec_helper"
require "dbus"

describe "IntrospectXMLParserTest" do
  it "tests split interfaces" do
    xml = <<-XML
      <node>
        <interface name="org.example.Foo">
          <method name="Dwim"/>
        </interface>
        <interface name="org.example.Bar">
          <method name="Drink"/>
        </interface>
        <interface name="org.example.Foo">
          <method name="Smurf"/>
        </interface>
      </node>
    XML

    interfaces, _subnodes = DBus::IntrospectXMLParser.new(xml).parse

    foo = interfaces.find { |i| i.name == "org.example.Foo" }
    expect(foo.methods.keys.size).to eq(2)
  end
end