mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Fix error in D-Bus test
* test/lisp/net/dbus-tests.el (dbus-test04-register-method): Do not check for error message text. (dbus--test-signal-handler): Fix docstring. (dbus--test-timeout-handler): New defun. (dbus-test05-register-signal) (dbus-test06-register-property-emits-signal): Use it.
This commit is contained in:
parent
013ac76b89
commit
b23beef3f2
1 changed files with 23 additions and 21 deletions
|
|
@ -222,12 +222,12 @@ This includes initialization and closing the bus."
|
||||||
;; The service is not registered yet.
|
;; The service is not registered yet.
|
||||||
(should
|
(should
|
||||||
(equal
|
(equal
|
||||||
(should-error
|
(butlast
|
||||||
(dbus-call-method
|
(should-error
|
||||||
:session dbus--test-service dbus--test-path
|
(dbus-call-method
|
||||||
dbus--test-interface method1 :timeout 10 "foo"))
|
:session dbus--test-service dbus--test-path
|
||||||
`(dbus-error
|
dbus--test-interface method1 :timeout 10 "foo")))
|
||||||
,dbus-error-service-unknown "The name is not activatable")))
|
`(dbus-error ,dbus-error-service-unknown)))
|
||||||
|
|
||||||
;; Register.
|
;; Register.
|
||||||
(should
|
(should
|
||||||
|
|
@ -283,7 +283,6 @@ This includes initialization and closing the bus."
|
||||||
(should-not (dbus-unregister-object registered))
|
(should-not (dbus-unregister-object registered))
|
||||||
(should
|
(should
|
||||||
(equal
|
(equal
|
||||||
;; We don't care the error message text.
|
|
||||||
(butlast
|
(butlast
|
||||||
(should-error
|
(should-error
|
||||||
(dbus-call-method
|
(dbus-call-method
|
||||||
|
|
@ -298,9 +297,13 @@ This includes initialization and closing the bus."
|
||||||
"Received signal value in `dbus--test-signal-handler'.")
|
"Received signal value in `dbus--test-signal-handler'.")
|
||||||
|
|
||||||
(defun dbus--test-signal-handler (&rest args)
|
(defun dbus--test-signal-handler (&rest args)
|
||||||
"Signal handler for `dbus-test05-register-signal'."
|
"Signal handler for `dbus-test*-signal'."
|
||||||
(setq dbus--test-signal-received args))
|
(setq dbus--test-signal-received args))
|
||||||
|
|
||||||
|
(defun dbus--test-timeout-handler (&rest _ignore)
|
||||||
|
"Timeout handler, reporting a failed test."
|
||||||
|
(ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test)))))
|
||||||
|
|
||||||
(ert-deftest dbus-test05-register-signal ()
|
(ert-deftest dbus-test05-register-signal ()
|
||||||
"Check signal registration for an own service."
|
"Check signal registration for an own service."
|
||||||
(skip-unless dbus--test-enabled-session-bus)
|
(skip-unless dbus--test-enabled-session-bus)
|
||||||
|
|
@ -327,8 +330,9 @@ This includes initialization and closing the bus."
|
||||||
(dbus-send-signal
|
(dbus-send-signal
|
||||||
:session dbus--test-service dbus--test-path
|
:session dbus--test-service dbus--test-path
|
||||||
dbus--test-interface member "foo")
|
dbus--test-interface member "foo")
|
||||||
(while (null dbus--test-signal-received)
|
(with-timeout (1 (dbus--test-timeout-handler))
|
||||||
(read-event nil nil 0.1))
|
(while (null dbus--test-signal-received)
|
||||||
|
(read-event nil nil 0.1)))
|
||||||
(should (equal dbus--test-signal-received '("foo")))
|
(should (equal dbus--test-signal-received '("foo")))
|
||||||
|
|
||||||
;; Send two arguments, compound types.
|
;; Send two arguments, compound types.
|
||||||
|
|
@ -337,8 +341,9 @@ This includes initialization and closing the bus."
|
||||||
:session dbus--test-service dbus--test-path
|
:session dbus--test-service dbus--test-path
|
||||||
dbus--test-interface member
|
dbus--test-interface member
|
||||||
'(:array :byte 1 :byte 2 :byte 3) '(:variant :string "bar"))
|
'(:array :byte 1 :byte 2 :byte 3) '(:variant :string "bar"))
|
||||||
(while (null dbus--test-signal-received)
|
(with-timeout (1 (dbus--test-timeout-handler))
|
||||||
(read-event nil nil 0.1))
|
(while (null dbus--test-signal-received)
|
||||||
|
(read-event nil nil 0.1)))
|
||||||
(should (equal dbus--test-signal-received '((1 2 3) ("bar"))))
|
(should (equal dbus--test-signal-received '((1 2 3) ("bar"))))
|
||||||
|
|
||||||
;; Unregister signal.
|
;; Unregister signal.
|
||||||
|
|
@ -385,7 +390,6 @@ This includes initialization and closing the bus."
|
||||||
(let ((dbus-show-dbus-errors t))
|
(let ((dbus-show-dbus-errors t))
|
||||||
(should
|
(should
|
||||||
(equal
|
(equal
|
||||||
;; We don't care the error message text.
|
|
||||||
(butlast
|
(butlast
|
||||||
(should-error
|
(should-error
|
||||||
(dbus-set-property
|
(dbus-set-property
|
||||||
|
|
@ -416,7 +420,6 @@ This includes initialization and closing the bus."
|
||||||
(let ((dbus-show-dbus-errors t))
|
(let ((dbus-show-dbus-errors t))
|
||||||
(should
|
(should
|
||||||
(equal
|
(equal
|
||||||
;; We don't care the error message text.
|
|
||||||
(butlast
|
(butlast
|
||||||
(should-error
|
(should-error
|
||||||
(dbus-get-property
|
(dbus-get-property
|
||||||
|
|
@ -469,7 +472,6 @@ This includes initialization and closing the bus."
|
||||||
(let ((dbus-show-dbus-errors t))
|
(let ((dbus-show-dbus-errors t))
|
||||||
(should
|
(should
|
||||||
(equal
|
(equal
|
||||||
;; We don't care the error message text.
|
|
||||||
(butlast
|
(butlast
|
||||||
(should-error
|
(should-error
|
||||||
(dbus-get-property
|
(dbus-get-property
|
||||||
|
|
@ -483,7 +485,6 @@ This includes initialization and closing the bus."
|
||||||
(let ((dbus-show-dbus-errors t))
|
(let ((dbus-show-dbus-errors t))
|
||||||
(should
|
(should
|
||||||
(equal
|
(equal
|
||||||
;; We don't care the error message text.
|
|
||||||
(butlast
|
(butlast
|
||||||
(should-error
|
(should-error
|
||||||
(dbus-set-property
|
(dbus-set-property
|
||||||
|
|
@ -522,7 +523,6 @@ This includes initialization and closing the bus."
|
||||||
(let ((dbus-show-dbus-errors t))
|
(let ((dbus-show-dbus-errors t))
|
||||||
(should
|
(should
|
||||||
(equal
|
(equal
|
||||||
;; We don't care the error message text.
|
|
||||||
(butlast
|
(butlast
|
||||||
(should-error
|
(should-error
|
||||||
(dbus-get-property
|
(dbus-get-property
|
||||||
|
|
@ -716,8 +716,9 @@ This includes initialization and closing the bus."
|
||||||
dbus--test-interface property :readwrite "foo" 'emits-signal)
|
dbus--test-interface property :readwrite "foo" 'emits-signal)
|
||||||
`((:property :session ,dbus--test-interface ,property)
|
`((:property :session ,dbus--test-interface ,property)
|
||||||
(,dbus--test-service ,dbus--test-path))))
|
(,dbus--test-service ,dbus--test-path))))
|
||||||
(while (null dbus--test-signal-received)
|
(with-timeout (1 (dbus--test-timeout-handler))
|
||||||
(read-event nil nil 0.1))
|
(while (null dbus--test-signal-received)
|
||||||
|
(read-event nil nil 0.1)))
|
||||||
;; It returns two arguments, "changed_properties" (an array of
|
;; It returns two arguments, "changed_properties" (an array of
|
||||||
;; dict entries) and "invalidated_properties" (an array of
|
;; dict entries) and "invalidated_properties" (an array of
|
||||||
;; strings).
|
;; strings).
|
||||||
|
|
@ -739,8 +740,9 @@ This includes initialization and closing the bus."
|
||||||
dbus--test-interface property
|
dbus--test-interface property
|
||||||
'(:array :byte 1 :byte 2 :byte 3))
|
'(:array :byte 1 :byte 2 :byte 3))
|
||||||
'(1 2 3)))
|
'(1 2 3)))
|
||||||
(while (null dbus--test-signal-received)
|
(with-timeout (1 (dbus--test-timeout-handler))
|
||||||
(read-event nil nil 0.1))
|
(while (null dbus--test-signal-received)
|
||||||
|
(read-event nil nil 0.1)))
|
||||||
(should
|
(should
|
||||||
(equal
|
(equal
|
||||||
dbus--test-signal-received `(((,property ((((1) (2) (3)))))) ())))
|
dbus--test-signal-received `(((,property ((((1) (2) (3)))))) ())))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue