Adapt a number of regression tests to Android

* test/infra/android/test-controller.el (ats-run-test): Strip
text properties from value string.  Inhibit text conversion.

* test/lisp/emacs-lisp/find-func-tests.el
(find-func-tests--locate-symbols):

* test/lisp/emacs-lisp/rmc-tests.el
(test-rmc--add-key-description)
(test-rmc--add-key-description/with-attributes)
(test-rmc--add-key-description/non-graphical-display)
(test-read-multiple-choice, test-read-multiple-choice-help):
Skip on Android in some wise or another.
This commit is contained in:
Po Lu 2025-02-26 11:33:05 +08:00
parent ecde11a83c
commit 2938afab36
3 changed files with 10 additions and 1 deletions

View file

@ -2436,6 +2436,7 @@ Display the output of the tests executed in a buffer."
;; present...
(ert-remote-temporary-file-directory
null-device)
(overriding-text-conversion-style nil)
(set-message-function
(lambda (message)
(with-current-buffer temp-buffer
@ -2443,7 +2444,8 @@ Display the output of the tests executed in a buffer."
(let ((noninteractive t))
(ert-run-tests-batch ',selector))
(insert "=== Test execution complete ===\n")
(buffer-string))))))
(buffer-substring-no-properties
(point-min) (point-max)))))))
(cond ((eq (car rc) 'error)
(error "Error executing `%s-tests.el': %S" test (cdr rc)))
(t (progn

View file

@ -45,6 +45,8 @@
(read-library-name)))))
(ert-deftest find-func-tests--locate-symbols ()
;; C source files are unavailable when testing on Android.
(skip-when (featurep 'android))
(should (cdr
(find-function-search-for-symbol
#'goto-line nil "simple")))

View file

@ -30,6 +30,7 @@
(eval-when-compile (require 'cl-lib))
(ert-deftest test-rmc--add-key-description ()
(skip-when (display-graphic-p))
(cl-letf (((symbol-function 'display-supports-face-attributes-p) (lambda (_ _) t)))
(should (equal (rmc--add-key-description '(?y "yes"))
'(?y . "yes")))
@ -39,6 +40,7 @@
`(?\s . "SPC foo bar")))))
(ert-deftest test-rmc--add-key-description/with-attributes ()
(skip-when (display-graphic-p))
(cl-letf (((symbol-function 'display-supports-face-attributes-p) (lambda (_ _) t)))
(should (equal-including-properties
(rmc--add-key-description '(?y "yes"))
@ -51,6 +53,7 @@
`(?\s . ,(concat (propertize "SPC" 'face 'read-multiple-choice-face) " foo bar"))))))
(ert-deftest test-rmc--add-key-description/non-graphical-display ()
(skip-when (display-graphic-p))
(cl-letf (((symbol-function 'display-supports-face-attributes-p) (lambda (_ _) nil)))
(should (equal-including-properties
(rmc--add-key-description '(?y "yes"))
@ -60,6 +63,7 @@
`(?n . ,(concat (propertize "n" 'face 'help-key-binding) " foo"))))))
(ert-deftest test-read-multiple-choice ()
(skip-when (display-graphic-p))
(dolist (char '(?y ?n))
(cl-letf* (((symbol-function #'read-key) (lambda () char))
(str (if (eq char ?y) "yes" "no")))
@ -67,6 +71,7 @@
(read-multiple-choice "Do it? " '((?y "yes") (?n "no"))))))))
(ert-deftest test-read-multiple-choice-help ()
(skip-when (display-graphic-p))
(let ((chars '(?o ?a))
help)
(cl-letf* (((symbol-function #'read-key)