diff options
| author | Mattias EngdegÄrd | 2020-07-05 17:44:34 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2020-07-05 17:44:34 +0200 |
| commit | 58e27ebb9210cbbd0c3a10992627bc1e1de89f32 (patch) | |
| tree | c7d69ab3afd4432120e09e6b7aa9061d4c14d765 | |
| parent | c10293e168f752607ae51edd09922505927c29b1 (diff) | |
| download | emacs-58e27ebb9210cbbd0c3a10992627bc1e1de89f32.tar.gz emacs-58e27ebb9210cbbd0c3a10992627bc1e1de89f32.zip | |
Don't confuse errors with nil in bytecomp-tests.el
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-check-1)
(bytecomp-explain-1, test-byte-opt-arithmetic, bytecomp-lexbind-check-1)
(bytecomp-lexbind-explain-1):
If an expression raises an error when evaluated, don't treat it as if
it had succeeded with the value nil; use 'bytecomp-check-error' as the
result instead.
| -rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index bfe2d06a61b..c235dd43fcc 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el | |||
| @@ -363,10 +363,10 @@ bytecompiled code, and their results compared.") | |||
| 363 | (byte-compile-warnings nil) | 363 | (byte-compile-warnings nil) |
| 364 | (v0 (condition-case nil | 364 | (v0 (condition-case nil |
| 365 | (eval pat) | 365 | (eval pat) |
| 366 | (error nil))) | 366 | (error 'bytecomp-check-error))) |
| 367 | (v1 (condition-case nil | 367 | (v1 (condition-case nil |
| 368 | (funcall (byte-compile (list 'lambda nil pat))) | 368 | (funcall (byte-compile (list 'lambda nil pat))) |
| 369 | (error nil)))) | 369 | (error 'bytecomp-check-error)))) |
| 370 | (equal v0 v1))) | 370 | (equal v0 v1))) |
| 371 | 371 | ||
| 372 | (put 'bytecomp-check-1 'ert-explainer 'bytecomp-explain-1) | 372 | (put 'bytecomp-check-1 'ert-explainer 'bytecomp-explain-1) |
| @@ -374,10 +374,10 @@ bytecompiled code, and their results compared.") | |||
| 374 | (defun bytecomp-explain-1 (pat) | 374 | (defun bytecomp-explain-1 (pat) |
| 375 | (let ((v0 (condition-case nil | 375 | (let ((v0 (condition-case nil |
| 376 | (eval pat) | 376 | (eval pat) |
| 377 | (error nil))) | 377 | (error 'bytecomp-check-error))) |
| 378 | (v1 (condition-case nil | 378 | (v1 (condition-case nil |
| 379 | (funcall (byte-compile (list 'lambda nil pat))) | 379 | (funcall (byte-compile (list 'lambda nil pat))) |
| 380 | (error nil)))) | 380 | (error 'bytecomp-check-error)))) |
| 381 | (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled." | 381 | (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled." |
| 382 | pat v0 v1))) | 382 | pat v0 v1))) |
| 383 | 383 | ||
| @@ -402,10 +402,10 @@ Subtests signal errors if something goes wrong." | |||
| 402 | (dolist (pat byte-opt-testsuite-arith-data) | 402 | (dolist (pat byte-opt-testsuite-arith-data) |
| 403 | (condition-case nil | 403 | (condition-case nil |
| 404 | (setq v0 (eval pat)) | 404 | (setq v0 (eval pat)) |
| 405 | (error (setq v0 nil))) | 405 | (error (setq v0 'bytecomp-check-error))) |
| 406 | (condition-case nil | 406 | (condition-case nil |
| 407 | (setq v1 (funcall (byte-compile (list 'lambda nil pat)))) | 407 | (setq v1 (funcall (byte-compile (list 'lambda nil pat)))) |
| 408 | (error (setq v1 nil))) | 408 | (error (setq v1 'bytecomp-check-error))) |
| 409 | (insert (format "%s" pat)) | 409 | (insert (format "%s" pat)) |
| 410 | (indent-to-column 65) | 410 | (indent-to-column 65) |
| 411 | (if (equal v0 v1) | 411 | (if (equal v0 v1) |
| @@ -561,11 +561,11 @@ bytecompiled code, and their results compared.") | |||
| 561 | (byte-compile-warnings nil) | 561 | (byte-compile-warnings nil) |
| 562 | (v0 (condition-case nil | 562 | (v0 (condition-case nil |
| 563 | (eval pat t) | 563 | (eval pat t) |
| 564 | (error nil))) | 564 | (error 'bytecomp-check-error))) |
| 565 | (v1 (condition-case nil | 565 | (v1 (condition-case nil |
| 566 | (funcall (let ((lexical-binding t)) | 566 | (funcall (let ((lexical-binding t)) |
| 567 | (byte-compile `(lambda nil ,pat)))) | 567 | (byte-compile `(lambda nil ,pat)))) |
| 568 | (error nil)))) | 568 | (error 'bytecomp-check-error)))) |
| 569 | (equal v0 v1))) | 569 | (equal v0 v1))) |
| 570 | 570 | ||
| 571 | (put 'bytecomp-lexbind-check-1 'ert-explainer 'bytecomp-lexbind-explain-1) | 571 | (put 'bytecomp-lexbind-check-1 'ert-explainer 'bytecomp-lexbind-explain-1) |
| @@ -573,11 +573,11 @@ bytecompiled code, and their results compared.") | |||
| 573 | (defun bytecomp-lexbind-explain-1 (pat) | 573 | (defun bytecomp-lexbind-explain-1 (pat) |
| 574 | (let ((v0 (condition-case nil | 574 | (let ((v0 (condition-case nil |
| 575 | (eval pat t) | 575 | (eval pat t) |
| 576 | (error nil))) | 576 | (error 'bytecomp-check-error))) |
| 577 | (v1 (condition-case nil | 577 | (v1 (condition-case nil |
| 578 | (funcall (let ((lexical-binding t)) | 578 | (funcall (let ((lexical-binding t)) |
| 579 | (byte-compile (list 'lambda nil pat)))) | 579 | (byte-compile (list 'lambda nil pat)))) |
| 580 | (error nil)))) | 580 | (error 'bytecomp-check-error)))) |
| 581 | (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled." | 581 | (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled." |
| 582 | pat v0 v1))) | 582 | pat v0 v1))) |
| 583 | 583 | ||