From: Andrea Corallo Date: Mon, 25 May 2020 19:14:24 +0000 (+0100) Subject: Add a compiler hint test X-Git-Tag: emacs-28.0.90~2727^2~609 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3fa73fa0fb1caedd10553d9f3185635c039319fd;p=emacs.git Add a compiler hint test Test that compiler hints are executed transparently. * test/src/comp-tests.el (comp-tests-type-hints): New test. * test/src/comp-test-funcs.el (comp-tests-hint-fixnum-f) (comp-tests-hint-cons-f): New functions. --- diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el index 9fcc132b518..5e04be4459f 100644 --- a/test/src/comp-test-funcs.el +++ b/test/src/comp-test-funcs.el @@ -50,6 +50,12 @@ (defun comp-tests-cons-cdr-f (x) (cdr (cons 'foo x))) +(defun comp-tests-hint-fixnum-f (n) + (1+ (comp-hint-fixnum n))) + +(defun comp-tests-hint-cons-f (c) + (car (comp-hint-cons c))) + (defun comp-tests-varset0-f () (setq comp-tests-var1 55)) (defun comp-tests-varset1-f () diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index c07c92a1065..3e40dba10b4 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -194,6 +194,12 @@ Check that the resulting binaries do not differ." (should-error (comp-tests-fixnum-minus-f 'a) :type 'wrong-type-argument)) +(ert-deftest comp-tests-type-hints () + "Just test compiler hints are transparent in this case." + ;; FIXME we should really check they are also effective. + (should (= (comp-tests-hint-fixnum-f 3) 4)) + (should (= (comp-tests-hint-cons-f (cons 1 2)) 1))) + (ert-deftest comp-tests-arith-comp () "Testing arithmetic comparisons." (should (eq (comp-tests-eqlsign-f 4 3) nil))