Sha256: 14f37c76a81ba5564b407b23181dfed11e00a8ce28f1b09b6103b54b1a6f8ccd
Contents?: true
Size: 1.6 KB
Versions: 3
Compression:
Stored size: 1.6 KB
Contents
#!/usr/bin/env ruby # should report it missing on org.ruby.SampleInterface # (on object...) instead of on DBus::Proxy::ObjectInterface require File.expand_path("../test_helper", __FILE__) require "test/unit" require "dbus" class ErrMsgTest < Test::Unit::TestCase def setup session_bus = DBus::ASessionBus.new svc = session_bus.service("org.ruby.service") @obj = svc.object("/org/ruby/MyInstance") @obj.introspect # necessary @obj.default_iface = "org.ruby.SampleInterface" end def test_report_dbus_interface begin @obj.NoSuchMethod # a specific exception... rescue NameError => e # mentioning DBus and the interface assert_match(/DBus interface.*#{@obj.default_iface}/, e.to_s) end end def test_report_short_struct begin @obj.test_variant ["(ss)", ["too few"] ] rescue DBus::TypeException => e assert_match(/1 elements but type info for 2/, e.to_s) end end def test_report_long_struct begin @obj.test_variant ["(ss)", ["a", "b", "too many"] ] rescue DBus::TypeException => e assert_match(/3 elements but type info for 2/, e.to_s) end end def test_report_nil nils = [ ["(s)", [nil] ], # would get disconnected ["i", nil ], ["a{ss}", {"foo" => nil} ], ] nils.each do |has_nil| begin @obj.test_variant has_nil rescue DBus::TypeException => e # TODO want backtrace from the perspective of the caller: # rescue/reraise in send_sync? assert_match(/Cannot send nil/, e.to_s) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-dbus-0.10.0 | test/err_msg_test.rb |
ruby-dbus-0.9.3 | test/t5-report-dbus-interface.rb |
ruby-dbus-0.9.2 | test/t5-report-dbus-interface.rb |