(defconst dbus--test-interface "org.gnu.Emacs.TestDBus.Interface"
"Test interface.")
-(defvar dbus--tests-dir
+(defconst dbus--tests-dir
(file-truename
(expand-file-name "dbus-resources"
(file-name-directory (or load-file-name
;; Cleanup.
(dbus-unregister-service :session dbus--test-service)))
-(defun dbus--test-method-reentry-handler (&rest args)
+(defun dbus--test-method-reentry-handler (&rest _args)
"Method handler for `dbus-test04-method-reentry'."
(dbus-get-all-managed-objects :session dbus--test-service dbus--test-path)
42)
"Check receiving method call while awaiting response.
Ensure that incoming method calls are handled when call to `dbus-call-method'
is in progress."
- ;; Simulate application registration (Bug#43251)
+ :tags '(:expensive-test)
+ ;; Simulate application registration. (Bug#43251)
(skip-unless dbus--test-enabled-session-bus)
(dbus-ignore-errors (dbus-unregister-service :session dbus--test-service))
(unwind-protect
- (let ((method "Rentry"))
+ (let ((method "Reentry"))
(should
(equal
(dbus-register-method
(should
(< 2.4 (float-time (time-since start)) 2.7)))
- (dbus-unregister-service :session dbus--test-service)))
-
+ ;; Cleanup.
+ (dbus-unregister-service :session dbus--test-service)))
(defvar dbus--test-signal-received nil
"Received signal value in `dbus--test-signal-handler'.")
(should (setq result1 (cadr (assoc dbus--test-interface result1))))
(should (equal (cdr (assoc name result1)) expected))))
-
(defsubst dbus--test-property (name &rest value-list)
"Test a D-Bus property named by string argument NAME.
The argument VALUE-LIST is a sequence of pairs, where each pair
("six"
((4 5 6)))))
'((:array
- :dict-entry (:string "key0" (:variant (:array :byte 7 :byte 8 :byte 9)))
+ :dict-entry
+ (:string "key0" (:variant (:array :byte 7 :byte 8 :byte 9)))
:dict-entry ("key1" (:variant :string "value"))
:dict-entry ("key2" (:variant :object-path "/node0/node1")))
. (("key0"
("nine"
((9 27 81)))))
'((:array
- (:dict-entry :string "key4" (:variant (:array :byte 7 :byte 49 :byte 125)))
+ (:dict-entry
+ :string "key4" (:variant (:array :byte 7 :byte 49 :byte 125)))
(:dict-entry "key5" (:variant :string "obsolete"))
(:dict-entry "key6" (:variant :object-path "/node6/node7")))
. (("key4"
(dbus--test-property
"ByteDictionary"
'((:array
- (:dict-entry :byte 8 (:variant :string "byte-eight"))
+ (:dict-entry :byte 8 (:variant :string "byte-eight"))
(:dict-entry :byte 16 (:variant :object-path "/byte/sixteen"))
(:dict-entry :byte 48 (:variant (:array :byte 8 :byte 9 :byte 10))))
- . ((8 ("byte-eight"))
+ . (( 8 ("byte-eight"))
(16 ("/byte/sixteen"))
(48 ((8 9 10))))))
'((:variant :uint32 1000000) . (1000000))
'((:variant :object-path "/variant/path") . ("/variant/path"))
'((:variant :signature "a{sa{sv}}") . ("a{sa{sv}}"))
- '((:variant (:struct 42 "string" (:object-path "/structure/path") (:variant "last")))
- . ((42 "string" ("/structure/path") ("last")))))
+ '((:variant
+ (:struct
+ 42 "string" (:object-path "/structure/path") (:variant "last")))
+ . ((42 "string" ("/structure/path") ("last")))))
;; Test that :read prevents writes.
(should
"StringArray")
'("one" "two" "three")))
- (should ; Verify property has registered value.
- (equal
- (dbus-get-property
- :session dbus--test-service dbus--test-path dbus--test-interface
- "StringArray")
- '("one" "two" "three")))
-
;; Test mismatched types in array.
(should-error
(dbus-register-property
"ByteValue")
1024))
-
(should ; Another change property type test.
(equal
(dbus-set-property
"Return test introspection string."
(when (string-equal dbus--test-path (dbus-event-path-name last-input-event))
(with-temp-buffer
- (insert-file (expand-file-name "org.gnu.Emacs.TestDBus.xml" dbus--tests-dir))
+ (insert-file-contents-literally
+ (expand-file-name "org.gnu.Emacs.TestDBus.xml" dbus--tests-dir))
(buffer-string))))
(defsubst dbus--test-validate-interface
annotations))
(defsubst dbus--test-validate-property
- (interface property-name expected-annotations &rest expected-args)
+ (interface property-name _expected-annotations &rest expected-args)
"Validate a property definition for `dbus-test07-introspection'.
The argument INTERFACE is a string naming the interface owning PROPERTY-NAME.
the method or signal."
(let (args annotations)
(mapc (lambda (elem)
- (let ((name (dbus-introspect-get-attribute elem "name")))
- (cond
- ((eq 'arg (car elem)) (push elem args))
- ((eq 'annotation (car elem)) (push elem annotations)))))
+ (cond
+ ((eq 'arg (car elem)) (push elem args))
+ ((eq 'annotation (car elem)) (push elem annotations))))
tree)
(should
(equal
(string-equal name (dbus-introspect-get-attribute signal "name")))
(dbus--test-validate-m-or-s rest expected-annotations expected-args))))
-
(defsubst dbus--test-validate-method
(interface method-name expected-annotations &rest expected-args)
"Validate a method definition for `dbus-test07-introspection'.
(dbus--test-validate-interface
dbus-interface-introspectable nil '("Introspect") nil nil)
- ;; dbus-introspect-get-interface via `dbus--test-validate-interface'
+ ;; dbus-introspect-get-interface via `dbus--test-validate-interface'.
(dbus--test-validate-interface
dbus-interface-properties nil
'("Get" "Set" "GetAll") '("PropertiesChanged") nil)
methods
'("Connect" "DeprecatedMethod0" "DeprecatedMethod1")))
- ;; dbus-introspect-get-method via 'dbus--test-validate-method
+ ;; dbus-introspect-get-method via `dbus--test-validate-method'.
(dbus--test-validate-method
dbus--test-interface "Connect" nil
'(arg ((name . "uuid") (type . "s") (direction . "in")))
signals
'("PropertiesChanged")))
- ;; dbus-introspect-get-signal via 'dbus--test-validate-signal
+ ;; dbus-introspect-get-signal via `dbus--test-validate-signal'.
(dbus--test-validate-signal
dbus-interface-properties "PropertiesChanged" nil
'(arg ((name . "interface") (type . "s")))
properties
'("Connected" "Player")))
- ;; dbus-introspect-get-property via 'dbus--test-validate-property
+ ;; dbus-introspect-get-property via `dbus--test-validate-property'.
(dbus--test-validate-property
dbus--test-interface "Connected" nil
'("Connected" "b" "read")
(should
(< 0.0 (float-time (time-since start)) 1.0)))
+ ;; Cleanup.
(dbus-unregister-service :session dbus--test-service)))
(ert-deftest dbus-test07-introspection-timeout ()
(should
(< 1.0 (float-time (time-since start)))))
- (dbus-unregister-service :session dbus--test-service)))
+ ;; Cleanup.
+ (dbus-unregister-service :session dbus--test-service)))
(defun dbus-test-all (&optional interactive)
"Run all tests for \\[dbus]."