aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-05-25 20:14:24 +0100
committerAndrea Corallo2020-05-25 22:24:53 +0100
commit3fa73fa0fb1caedd10553d9f3185635c039319fd (patch)
treea8d5cb5d1505428100bcd7874999bcfad7203304 /test/src
parentf28b1780c6d5ed974e414a423cef8d11ed8145e6 (diff)
downloademacs-3fa73fa0fb1caedd10553d9f3185635c039319fd.tar.gz
emacs-3fa73fa0fb1caedd10553d9f3185635c039319fd.zip
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.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/comp-test-funcs.el6
-rw-r--r--test/src/comp-tests.el6
2 files changed, 12 insertions, 0 deletions
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 @@
50(defun comp-tests-cons-cdr-f (x) 50(defun comp-tests-cons-cdr-f (x)
51 (cdr (cons 'foo x))) 51 (cdr (cons 'foo x)))
52 52
53(defun comp-tests-hint-fixnum-f (n)
54 (1+ (comp-hint-fixnum n)))
55
56(defun comp-tests-hint-cons-f (c)
57 (car (comp-hint-cons c)))
58
53(defun comp-tests-varset0-f () 59(defun comp-tests-varset0-f ()
54 (setq comp-tests-var1 55)) 60 (setq comp-tests-var1 55))
55(defun comp-tests-varset1-f () 61(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."
194 (should-error (comp-tests-fixnum-minus-f 'a) 194 (should-error (comp-tests-fixnum-minus-f 'a)
195 :type 'wrong-type-argument)) 195 :type 'wrong-type-argument))
196 196
197(ert-deftest comp-tests-type-hints ()
198 "Just test compiler hints are transparent in this case."
199 ;; FIXME we should really check they are also effective.
200 (should (= (comp-tests-hint-fixnum-f 3) 4))
201 (should (= (comp-tests-hint-cons-f (cons 1 2)) 1)))
202
197(ert-deftest comp-tests-arith-comp () 203(ert-deftest comp-tests-arith-comp ()
198 "Testing arithmetic comparisons." 204 "Testing arithmetic comparisons."
199 (should (eq (comp-tests-eqlsign-f 4 3) nil)) 205 (should (eq (comp-tests-eqlsign-f 4 3) nil))