annotate tests/automated/byte-compiler-tests.el @ 5940:c608d4b0b75e cygwin64 tip

rescue lost branch from 64bit.backup
author Henry Thompson <ht@markup.co.uk>
date Thu, 16 Dec 2021 18:48:58 +0000
parents ac37a5f7e5be
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;; Copyright (C) 1998 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Author: Martin Buchholz <martin@xemacs.org>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Maintainer: Martin Buchholz <martin@xemacs.org>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Created: 1998
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 ;; Keywords: tests
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
10 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
11 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
12 ;; Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
13 ;; option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
16 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
17 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
18 ;; for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
21 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;;; Synched up with: Not in FSF.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 ;;; Test byte-compiler functionality
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;;; See test-harness.el
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 (condition-case err
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 (require 'test-harness)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 (file-error
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 (when (and (boundp 'load-file-name) (stringp load-file-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 (push (file-name-directory load-file-name) load-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 (require 'test-harness))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 (require 'bytecomp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 ;; test constant symbol warnings
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 (defmacro check-byte-compiler-message (message-regexp &rest body)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 `(Check-Message ,message-regexp (byte-compile '(lambda () ,@body))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 (check-byte-compiler-message "Attempt to set non-symbol" (setq 1 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 (check-byte-compiler-message "Attempt to set constant symbol" (setq t 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 (check-byte-compiler-message "Attempt to set constant symbol" (setq nil 1))
5370
4c4b96b13f70 Address the easy test failures in tests/automated.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5136
diff changeset
46 (check-byte-compiler-message "Attempt to set constant symbol" (defconst :foo 1))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 (check-byte-compiler-message "Attempt to let-bind non-symbol" (let ((1 'x)) 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 (check-byte-compiler-message "Attempt to let-bind constant symbol" (let ((t 'x)) (foo)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 (check-byte-compiler-message "Attempt to let-bind constant symbol" (let ((nil 'x)) (foo)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 (check-byte-compiler-message "Attempt to let-bind constant symbol" (let ((:foo 'x)) (foo)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 (check-byte-compiler-message "bound but not referenced" (let ((foo 'x)) 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 (Assert (not (boundp 'free-variable)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 (Assert (boundp 'byte-compile-warnings))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 (check-byte-compiler-message "assignment to free variable" (setq free-variable 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 (check-byte-compiler-message "reference to free variable" (car free-variable))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 (check-byte-compiler-message "called with 2 args, but requires 1" (car 'x 'y))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 (let ((fun '(lambda () (setq :foo 1))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 (fset 'test-byte-compiler-fun fun))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 (Check-Error setting-constant (test-byte-compiler-fun))
5370
4c4b96b13f70 Address the easy test failures in tests/automated.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5136
diff changeset
64 (Check-Message "Attempt to set constant symbol"
4c4b96b13f70 Address the easy test failures in tests/automated.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5136
diff changeset
65 (byte-compile 'test-byte-compiler-fun))
4c4b96b13f70 Address the easy test failures in tests/automated.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5136
diff changeset
66
4c4b96b13f70 Address the easy test failures in tests/automated.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5136
diff changeset
67 ;; Once NEED_TO_HANDLE_21_4_CODE is no longer defined in C, this will error
4c4b96b13f70 Address the easy test failures in tests/automated.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5136
diff changeset
68 ;; correctly. It's disabled because the packages are compiled by 21.4.
4c4b96b13f70 Address the easy test failures in tests/automated.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5136
diff changeset
69 (Known-Bug-Expect-Failure
4c4b96b13f70 Address the easy test failures in tests/automated.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5136
diff changeset
70 (Check-Error setting-constant (test-byte-compiler-fun)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 (eval-when-compile (defvar setq-test-foo nil) (defvar setq-test-bar nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 (check-byte-compiler-message "set called with 1 arg, but requires 2" (setq setq-test-foo))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 (check-byte-compiler-message "set called with 1 arg, but requires 2" (setq setq-test-foo 1 setq-test-bar))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 (check-byte-compiler-message "set-default called with 1 arg, but requires 2" (setq-default setq-test-foo))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 (check-byte-compiler-message "set-default called with 1 arg, but requires 2" (setq-default setq-test-foo 1 setq-test-bar))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 ;;-----------------------------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 ;; let, let*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 ;;-----------------------------------------------------
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 ;; Test interpreted and compiled lisp separately here
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 (check-byte-compiler-message "malformed let binding" (let ((x 1 2)) 3))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 (check-byte-compiler-message "malformed let binding" (let* ((x 1 2)) 3))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 (Check-Error-Message
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 error "`let' bindings can have only one value-form"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 (eval '(let ((x 1 2)) 3)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 (Check-Error-Message
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 error "`let' bindings can have only one value-form"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 (eval '(let* ((x 1 2)) 3)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
96 (defmacro before-and-after-compile-equal (&rest form)
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
97 `(Assert (equal (funcall (quote (lambda () ,@form)))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
98 (funcall (byte-compile (quote (lambda () ,@form)))))))
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
99
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
100 (defvar simplyamarker (point-min-marker))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
101
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
102 ;; The byte optimizer must be careful with +/- with a single argument.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
103
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
104 (before-and-after-compile-equal (+))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
105 (before-and-after-compile-equal (+ 2 2))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
106 (before-and-after-compile-equal (+ 2 1))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
107 (before-and-after-compile-equal (+ 1 2))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
108 ;; (+ 1) is OK. but (+1) signals an error.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
109 (before-and-after-compile-equal (+ 1))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
110 (before-and-after-compile-equal (+ 3))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
111 (before-and-after-compile-equal (+ simplyamarker 1))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
112 ;; The optimization (+ m) --> m is invalid when m is a marker.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
113 ;; Currently the following test fails - controversial.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
114 ;; (before-and-after-compile-equal (+ simplyamarker))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
115 ;; Same tests for minus.
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
116 (before-and-after-compile-equal (- 2 2))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
117 (before-and-after-compile-equal (- 2 1))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
118 (before-and-after-compile-equal (- 1 2))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
119 (before-and-after-compile-equal (- 1))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
120 (before-and-after-compile-equal (- 3))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
121 (before-and-after-compile-equal (- simplyamarker 1))
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 428
diff changeset
122 (before-and-after-compile-equal (- simplyamarker))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
123
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 444
diff changeset
124 (before-and-after-compile-equal (let ((z 1)) (or (setq z 42)) z))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 444
diff changeset
125
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
126 ;; byte-after-unbind-ops
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
127
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
128 ;; byte-constant
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
129 ;; byte-dup
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
130
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
131 ;; byte-symbolp
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
132 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
133 (let ((x 's))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
134 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
135 (symbolp x)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
136 (setq x 1))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
137
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
138 ;; byte-consp
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
139 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
140 (let ((x '(a b)))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
141 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
142 (consp x)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
143 (setq x 1))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
144
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
145 ;; byte-stringp
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
146 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
147 (let ((x "a"))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
148 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
149 (stringp x)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
150 (setq x 1))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
151
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
152 ;; byte-listp
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
153 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
154 (let ((x '(a b c)))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
155 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
156 (listp x)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
157 (setq x 1))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
158
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
159 ;; byte-numberp
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
160 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
161 (let ((x 1))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
162 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
163 (numberp x)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
164 (setq x nil))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
165
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
166 ;; byte-integerp
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
167 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
168 (let ((x 1))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
169 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
170 (integerp x)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
171 (setq x nil))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
172
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
173 ;; byte-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
174 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
175 (let ((x 'a)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
176 (y 'a))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
177 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
178 (eq x y)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
179 (setq x 'c))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
180
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
181 ;; byte-not
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
182 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
183 (let (x)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
184 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
185 (not x)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
186 (setq x t))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
187
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
188 ;; byte-cons
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
189 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
190 (equal '(1 . 2)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
191 (let ((x 1)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
192 (y 2))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
193 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
194 (cons x y)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
195 (setq x t)))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
196
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
197 ;; byte-list1
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
198 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
199 (equal '(1)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
200 (let ((x 1))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
201 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
202 (list x)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
203 (setq x t)))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
204
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
205 ;; byte-list2
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
206 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
207 (equal '(1 . 2)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
208 (let ((x 1)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
209 (y 2))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
210 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
211 (list x y)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
212 (setq x t)))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
213
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
214 ;; byte-interactive-p
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
215
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
216 ;; byte-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
217 (before-and-after-compile-equal
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
218 (let (x y)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
219 (setq x '(1 . 2))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
220 (setq y '(1 . 2))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
221 (unwind-protect
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
222 (equal x y)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 434
diff changeset
223 (setq y '(1 . 3)))))