comparison tests/automated/byte-compiler-tests.el @ 434:9d177e8d4150 r21-2-25

Import from CVS: tag r21-2-25
author cvs
date Mon, 13 Aug 2007 11:30:53 +0200
parents 3ecd8885ac67
children 576fb035e263
comparison
equal deleted inserted replaced
433:892ca416f0fb 434:9d177e8d4150
89 89
90 (Check-Error-Message 90 (Check-Error-Message
91 error "`let' bindings can have only one value-form" 91 error "`let' bindings can have only one value-form"
92 (eval '(let* ((x 1 2)) 3))) 92 (eval '(let* ((x 1 2)) 3)))
93 93
94 (defmacro before-and-after-compile-equal (&rest form)
95 `(Assert (equal (funcall (quote (lambda () ,@form)))
96 (funcall (byte-compile (quote (lambda () ,@form)))))))
97
98 (defvar simplyamarker (point-min-marker))
99
100 ;; The byte optimizer must be careful with +/- with a single argument.
101
102 (before-and-after-compile-equal (+))
103 (before-and-after-compile-equal (+ 2 2))
104 (before-and-after-compile-equal (+ 2 1))
105 (before-and-after-compile-equal (+ 1 2))
106 ;; (+ 1) is OK. but (+1) signals an error.
107 (before-and-after-compile-equal (+ 1))
108 (before-and-after-compile-equal (+ 3))
109 (before-and-after-compile-equal (+ simplyamarker 1))
110 ;; The optimization (+ m) --> m is invalid when m is a marker.
111 ;; Currently the following test fails - controversial.
112 ;; (before-and-after-compile-equal (+ simplyamarker))
113 ;; Same tests for minus.
114 (before-and-after-compile-equal (- 2 2))
115 (before-and-after-compile-equal (- 2 1))
116 (before-and-after-compile-equal (- 1 2))
117 (before-and-after-compile-equal (- 1))
118 (before-and-after-compile-equal (- 3))
119 (before-and-after-compile-equal (- simplyamarker 1))
120 (before-and-after-compile-equal (- simplyamarker))