aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorStephen Gildea2021-11-26 08:51:38 -0800
committerStephen Gildea2021-11-26 08:51:38 -0800
commit11860f89a593a8cfe7efb94e86370bbbe4318fba (patch)
tree6addcc49642d94dfa8c780644f4474d01d60c218 /test/src
parentdd6b151c25551fe125d61a54890756d9454cc402 (diff)
downloademacs-11860f89a593a8cfe7efb94e86370bbbe4318fba.tar.gz
emacs-11860f89a593a8cfe7efb94e86370bbbe4318fba.zip
* test/src/comp-tests.el: Eliminate byte-compiler warnings (Bug#52105).
Diffstat (limited to 'test/src')
-rw-r--r--test/src/comp-tests.el37
1 files changed, 27 insertions, 10 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 025bc2058ec..f66a1932058 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -27,14 +27,23 @@
27 27
28(require 'ert) 28(require 'ert)
29(require 'ert-x) 29(require 'ert-x)
30(require 'cl-lib) 30(eval-when-compile
31 31 (require 'cl-lib)
32(defconst comp-test-src (ert-resource-file "comp-test-funcs.el")) 32 (require 'comp))
33 33(eval-and-compile
34(defconst comp-test-dyn-src (ert-resource-file "comp-test-funcs-dyn.el")) 34 (require 'comp-cstr) ;in eval-and-compile for its defstruct
35 35 (defconst comp-test-src (ert-resource-file "comp-test-funcs.el"))
36(when (featurep 'native-compile) 36 (defconst comp-test-dyn-src (ert-resource-file "comp-test-funcs-dyn.el"))
37 (require 'comp) 37 (defconst comp-test-pure-src (ert-resource-file "comp-test-pure.el"))
38 (defconst comp-test-45603-src (ert-resource-file "comp-test-45603.el"))
39 ;; Load the test code here so the compiler can check the function
40 ;; names used in this file.
41 (load comp-test-src nil t)
42 (load comp-test-dyn-src nil t)
43 (load comp-test-pure-src nil t)
44 (load comp-test-45603-src nil t))
45
46(when (native-comp-available-p)
38 (message "Compiling tests...") 47 (message "Compiling tests...")
39 (load (native-compile comp-test-src)) 48 (load (native-compile comp-test-src))
40 (load (native-compile comp-test-dyn-src))) 49 (load (native-compile comp-test-dyn-src)))
@@ -352,6 +361,8 @@ Check that the resulting binaries do not differ."
352 comp-test-interactive-form2-f))) 361 comp-test-interactive-form2-f)))
353 (should-not (commandp #'comp-tests-doc-f))) 362 (should-not (commandp #'comp-tests-doc-f)))
354 363
364(declare-function comp-tests-free-fun-f nil)
365
355(comp-deftest free-fun () 366(comp-deftest free-fun ()
356 "Check we are able to compile a single function." 367 "Check we are able to compile a single function."
357 (eval '(defun comp-tests-free-fun-f () 368 (eval '(defun comp-tests-free-fun-f ()
@@ -369,6 +380,8 @@ Check that the resulting binaries do not differ."
369 (should (equal (interactive-form #'comp-tests-free-fun-f) 380 (should (equal (interactive-form #'comp-tests-free-fun-f)
370 '(interactive)))) 381 '(interactive))))
371 382
383(declare-function comp-tests/free\fun-f nil)
384
372(comp-deftest free-fun-silly-name () 385(comp-deftest free-fun-silly-name ()
373 "Check we are able to compile a single function." 386 "Check we are able to compile a single function."
374 (eval '(defun comp-tests/free\fun-f ()) t) 387 (eval '(defun comp-tests/free\fun-f ()) t)
@@ -493,7 +506,7 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
493 506
494(comp-deftest 45603-1 () 507(comp-deftest 45603-1 ()
495 "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01994.html>" 508 "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01994.html>"
496 (load (native-compile (ert-resource-file "comp-test-45603.el"))) 509 (load (native-compile comp-test-45603-src))
497 (should (fboundp #'comp-test-45603--file-local-name))) 510 (should (fboundp #'comp-test-45603--file-local-name)))
498 511
499(comp-deftest 46670-1 () 512(comp-deftest 46670-1 ()
@@ -786,6 +799,8 @@ Return a list of results."
786 (comp-tests-mentioned-p (comp-c-func-name 'comp-tests-tco-f "F" t) 799 (comp-tests-mentioned-p (comp-c-func-name 'comp-tests-tco-f "F" t)
787 insn))))))) 800 insn)))))))
788 801
802(declare-function comp-tests-tco-f nil)
803
789(comp-deftest tco () 804(comp-deftest tco ()
790 "Check for tail recursion elimination." 805 "Check for tail recursion elimination."
791 (let ((native-comp-speed 3) 806 (let ((native-comp-speed 3)
@@ -814,6 +829,8 @@ Return a list of results."
814 (or (comp-tests-mentioned-p 'concat insn) 829 (or (comp-tests-mentioned-p 'concat insn)
815 (comp-tests-mentioned-p 'length insn))))))) 830 (comp-tests-mentioned-p 'length insn)))))))
816 831
832(declare-function comp-tests-fw-prop-1-f nil)
833
817(comp-deftest fw-prop-1 () 834(comp-deftest fw-prop-1 ()
818 "Some tests for forward propagation." 835 "Some tests for forward propagation."
819 (let ((native-comp-speed 2) 836 (let ((native-comp-speed 2)
@@ -1404,7 +1421,7 @@ folded."
1404 (let ((native-comp-speed 3) 1421 (let ((native-comp-speed 3)
1405 (comp-post-pass-hooks '((comp-final comp-tests-pure-checker-1 1422 (comp-post-pass-hooks '((comp-final comp-tests-pure-checker-1
1406 comp-tests-pure-checker-2)))) 1423 comp-tests-pure-checker-2))))
1407 (load (native-compile (ert-resource-file "comp-test-pure.el"))) 1424 (load (native-compile comp-test-pure-src))
1408 1425
1409 (should (subr-native-elisp-p (symbol-function #'comp-tests-pure-caller-f))) 1426 (should (subr-native-elisp-p (symbol-function #'comp-tests-pure-caller-f)))
1410 (should (= (comp-tests-pure-caller-f) 4)) 1427 (should (= (comp-tests-pure-caller-f) 4))