From 3e073520b341228d7a54a242e3d09862948e5c08 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 12 Sep 2020 11:57:42 -0700 Subject: [PATCH] Adapt some tests for Emacs's excitingly variable quoting format * test/lisp/subr-tests.el (subr-test-version-parsing): * test/lisp/emacs-lisp/gv-tests.el (gv-dont-define-expander-other-file): * test/src/callint-tests.el (call-interactively/incomplete-multibyte-sequence): * test/src/emacs-module-tests.el (module/describe-function-1): Don't fail if curly quotes are in use, as they can be if LC_ALL != C. --- test/lisp/emacs-lisp/gv-tests.el | 5 ++- test/lisp/subr-tests.el | 68 ++++++++++++++++---------------- test/src/callint-tests.el | 3 +- test/src/emacs-module-tests.el | 3 +- 4 files changed, 42 insertions(+), 37 deletions(-) diff --git a/test/lisp/emacs-lisp/gv-tests.el b/test/lisp/emacs-lisp/gv-tests.el index 10e3b531f36..29e4273b478 100644 --- a/test/lisp/emacs-lisp/gv-tests.el +++ b/test/lisp/emacs-lisp/gv-tests.el @@ -135,8 +135,9 @@ "--eval" (prin1-to-string '(progn (setf (gv-test-foo gv-test-pair) 99) (message "%d" (car gv-test-pair))))) - (should (equal (buffer-string) - "Symbol's function definition is void: \\(setf\\ gv-test-foo\\)\n"))))) + (should (string-match + "\\`Symbol.s function definition is void: \\\\(setf\\\\ gv-test-foo\\\\)\n\\'" + (buffer-string)))))) (ert-deftest gv-setter-edebug () "Check that a setter can be defined and edebugged together with diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index e2761a96f86..2df5537102f 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -172,27 +172,28 @@ (should (equal (version-to-list "6.9.30Beta") '(6 9 30 -2))) (should (equal (version-to-list "6.9.30_Beta") '(6 9 30 -2))) - (should (equal - (error-message-string (should-error (version-to-list "OTP-18.1.5"))) - "Invalid version syntax: `OTP-18.1.5' (must start with a number)")) - (should (equal - (error-message-string (should-error (version-to-list ""))) - "Invalid version syntax: `' (must start with a number)")) - (should (equal - (error-message-string (should-error (version-to-list "1.0..7.5"))) - "Invalid version syntax: `1.0..7.5'")) - (should (equal - (error-message-string (should-error (version-to-list "1.0prepre2"))) - "Invalid version syntax: `1.0prepre2'")) - (should (equal - (error-message-string (should-error (version-to-list "22.8X3"))) - "Invalid version syntax: `22.8X3'")) - (should (equal - (error-message-string (should-error (version-to-list "beta22.8alpha3"))) - "Invalid version syntax: `beta22.8alpha3' (must start with a number)")) - (should (equal - (error-message-string (should-error (version-to-list "honk"))) - "Invalid version syntax: `honk' (must start with a number)")) + (let ((text-quoting-style 'grave)) + (should (equal + (error-message-string (should-error (version-to-list "OTP-18.1.5"))) + "Invalid version syntax: `OTP-18.1.5' (must start with a number)")) + (should (equal + (error-message-string (should-error (version-to-list ""))) + "Invalid version syntax: `' (must start with a number)")) + (should (equal + (error-message-string (should-error (version-to-list "1.0..7.5"))) + "Invalid version syntax: `1.0..7.5'")) + (should (equal + (error-message-string (should-error (version-to-list "1.0prepre2"))) + "Invalid version syntax: `1.0prepre2'")) + (should (equal + (error-message-string (should-error (version-to-list "22.8X3"))) + "Invalid version syntax: `22.8X3'")) + (should (equal + (error-message-string (should-error (version-to-list "beta22.8alpha3"))) + "Invalid version syntax: `beta22.8alpha3' (must start with a number)")) + (should (equal + (error-message-string (should-error (version-to-list "honk"))) + "Invalid version syntax: `honk' (must start with a number)"))) (should (equal (error-message-string (should-error (version-to-list 9))) "Version must be a string")) @@ -231,18 +232,19 @@ (should (equal (version-to-list "6_9_30.Beta") '(6 9 30 -2))) (should (equal (version-to-list "6_9_30Beta") '(6 9 30 -2))) - (should (equal - (error-message-string (should-error (version-to-list "1_0__7_5"))) - "Invalid version syntax: `1_0__7_5'")) - (should (equal - (error-message-string (should-error (version-to-list "1_0prepre2"))) - "Invalid version syntax: `1_0prepre2'")) - (should (equal - (error-message-string (should-error (version-to-list "22.8X3"))) - "Invalid version syntax: `22.8X3'")) - (should (equal - (error-message-string (should-error (version-to-list "beta22_8alpha3"))) - "Invalid version syntax: `beta22_8alpha3' (must start with a number)")))) + (let ((text-quoting-style 'grave)) + (should (equal + (error-message-string (should-error (version-to-list "1_0__7_5"))) + "Invalid version syntax: `1_0__7_5'")) + (should (equal + (error-message-string (should-error (version-to-list "1_0prepre2"))) + "Invalid version syntax: `1_0prepre2'")) + (should (equal + (error-message-string (should-error (version-to-list "22.8X3"))) + "Invalid version syntax: `22.8X3'")) + (should (equal + (error-message-string (should-error (version-to-list "beta22_8alpha3"))) + "Invalid version syntax: `beta22_8alpha3' (must start with a number)"))))) (ert-deftest subr-test-version-list-< () (should (version-list-< '(0) '(1))) diff --git a/test/src/callint-tests.el b/test/src/callint-tests.el index c2010ae31d3..42dae424476 100644 --- a/test/src/callint-tests.el +++ b/test/src/callint-tests.el @@ -29,7 +29,8 @@ (ert-deftest call-interactively/incomplete-multibyte-sequence () "Check that Bug#30004 is fixed." - (let ((data (should-error (call-interactively (lambda () (interactive "\xFF")))))) + (let* ((text-quoting-style 'grave) + (data (should-error (call-interactively (lambda () (interactive "\xFF")))))) (should (equal (cdr data) diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 0fd8e1db49e..096c6b30574 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -309,7 +309,8 @@ local reference." (ert-deftest module/describe-function-1 () "Check that Bug#30163 is fixed." (with-temp-buffer - (let ((standard-output (current-buffer))) + (let ((standard-output (current-buffer)) + (text-quoting-style 'grave)) (describe-function-1 #'mod-test-sum) (goto-char (point-min)) (while (re-search-forward "`[^']*/data/emacs-module/" nil t) -- 2.39.5