aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/emacs-lisp/bytecomp-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/emacs-lisp/bytecomp-tests.el')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el43
1 files changed, 22 insertions, 21 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 894914300ae..834e3b6d914 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -365,24 +365,24 @@ bytecompiled code, and their results compared.")
365(defun bytecomp-check-1 (pat) 365(defun bytecomp-check-1 (pat)
366 "Return non-nil if PAT is the same whether directly evalled or compiled." 366 "Return non-nil if PAT is the same whether directly evalled or compiled."
367 (let ((warning-minimum-log-level :emergency) 367 (let ((warning-minimum-log-level :emergency)
368 (byte-compile-warnings nil) 368 (byte-compile-warnings nil)
369 (v0 (condition-case nil 369 (v0 (condition-case err
370 (eval pat) 370 (eval pat)
371 (error 'bytecomp-check-error))) 371 (error (list 'bytecomp-check-error (car err)))))
372 (v1 (condition-case nil 372 (v1 (condition-case err
373 (funcall (byte-compile (list 'lambda nil pat))) 373 (funcall (byte-compile (list 'lambda nil pat)))
374 (error 'bytecomp-check-error)))) 374 (error (list 'bytecomp-check-error (car err))))))
375 (equal v0 v1))) 375 (equal v0 v1)))
376 376
377(put 'bytecomp-check-1 'ert-explainer 'bytecomp-explain-1) 377(put 'bytecomp-check-1 'ert-explainer 'bytecomp-explain-1)
378 378
379(defun bytecomp-explain-1 (pat) 379(defun bytecomp-explain-1 (pat)
380 (let ((v0 (condition-case nil 380 (let ((v0 (condition-case err
381 (eval pat) 381 (eval pat)
382 (error 'bytecomp-check-error))) 382 (error (list 'bytecomp-check-error (car err)))))
383 (v1 (condition-case nil 383 (v1 (condition-case err
384 (funcall (byte-compile (list 'lambda nil pat))) 384 (funcall (byte-compile (list 'lambda nil pat)))
385 (error 'bytecomp-check-error)))) 385 (error (list 'bytecomp-check-error (car err))))))
386 (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled." 386 (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled."
387 pat v0 v1))) 387 pat v0 v1)))
388 388
@@ -405,12 +405,12 @@ Subtests signal errors if something goes wrong."
405 (print-quoted t) 405 (print-quoted t)
406 v0 v1) 406 v0 v1)
407 (dolist (pat byte-opt-testsuite-arith-data) 407 (dolist (pat byte-opt-testsuite-arith-data)
408 (condition-case nil 408 (condition-case err
409 (setq v0 (eval pat)) 409 (setq v0 (eval pat))
410 (error (setq v0 'bytecomp-check-error))) 410 (error (setq v0 (list 'bytecomp-check-error (car err)))))
411 (condition-case nil 411 (condition-case err
412 (setq v1 (funcall (byte-compile (list 'lambda nil pat)))) 412 (setq v1 (funcall (byte-compile (list 'lambda nil pat))))
413 (error (setq v1 'bytecomp-check-error))) 413 (error (setq v1 (list 'bytecomp-check-error (car err)))))
414 (insert (format "%s" pat)) 414 (insert (format "%s" pat))
415 (indent-to-column 65) 415 (indent-to-column 65)
416 (if (equal v0 v1) 416 (if (equal v0 v1)
@@ -479,6 +479,7 @@ Subtests signal errors if something goes wrong."
479(ert-deftest bytecomp-tests--warnings () 479(ert-deftest bytecomp-tests--warnings ()
480 (with-current-buffer (get-buffer-create "*Compile-Log*") 480 (with-current-buffer (get-buffer-create "*Compile-Log*")
481 (let ((inhibit-read-only t)) (erase-buffer))) 481 (let ((inhibit-read-only t)) (erase-buffer)))
482 (mapc #'fmakunbound '(my-test0 my--test11 my--test12 my--test2))
482 (test-byte-comp-compile-and-load t 483 (test-byte-comp-compile-and-load t
483 '(progn 484 '(progn
484 (defun my-test0 () 485 (defun my-test0 ()
@@ -564,25 +565,25 @@ bytecompiled code, and their results compared.")
564 "Return non-nil if PAT is the same whether directly evalled or compiled." 565 "Return non-nil if PAT is the same whether directly evalled or compiled."
565 (let ((warning-minimum-log-level :emergency) 566 (let ((warning-minimum-log-level :emergency)
566 (byte-compile-warnings nil) 567 (byte-compile-warnings nil)
567 (v0 (condition-case nil 568 (v0 (condition-case err
568 (eval pat t) 569 (eval pat t)
569 (error 'bytecomp-check-error))) 570 (error (list 'bytecomp-check-error (car err)))))
570 (v1 (condition-case nil 571 (v1 (condition-case err
571 (funcall (let ((lexical-binding t)) 572 (funcall (let ((lexical-binding t))
572 (byte-compile `(lambda nil ,pat)))) 573 (byte-compile `(lambda nil ,pat))))
573 (error 'bytecomp-check-error)))) 574 (error (list 'bytecomp-check-error (car err))))))
574 (equal v0 v1))) 575 (equal v0 v1)))
575 576
576(put 'bytecomp-lexbind-check-1 'ert-explainer 'bytecomp-lexbind-explain-1) 577(put 'bytecomp-lexbind-check-1 'ert-explainer 'bytecomp-lexbind-explain-1)
577 578
578(defun bytecomp-lexbind-explain-1 (pat) 579(defun bytecomp-lexbind-explain-1 (pat)
579 (let ((v0 (condition-case nil 580 (let ((v0 (condition-case err
580 (eval pat t) 581 (eval pat t)
581 (error 'bytecomp-check-error))) 582 (error (list 'bytecomp-check-error (car err)))))
582 (v1 (condition-case nil 583 (v1 (condition-case err
583 (funcall (let ((lexical-binding t)) 584 (funcall (let ((lexical-binding t))
584 (byte-compile (list 'lambda nil pat)))) 585 (byte-compile (list 'lambda nil pat))))
585 (error 'bytecomp-check-error)))) 586 (error (list 'bytecomp-check-error (car err))))))
586 (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled." 587 (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled."
587 pat v0 v1))) 588 pat v0 v1)))
588 589