/[guile]/guile/guile-core/test-suite/tests/elisp.test
ViewVC logotype

Diff of /guile/guile-core/test-suite/tests/elisp.test

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by ossau, Wed Jan 30 00:03:40 2002 UTC revision 1.4 by ossau, Fri Feb 8 13:00:30 2002 UTC
# Line 279  Line 279 
279    
280        ))        ))
281    
282    (if (defined? '%nil)
283        (use-modules (lang elisp interface)))
284    
285    (if (defined? '%nil)
286    
287        (with-test-prefix "elisp"
288    
289          (define (elisp-pass-if expr expected)
290            (pass-if (with-output-to-string
291                      (lambda ()
292                        (write expr)))
293                     (let ((calc (with-output-to-string
294                                  (lambda ()
295                                    (write (eval-elisp expr))))))
296                       (string=? calc expected))))
297          
298          (elisp-pass-if '(and #f) "#f")
299          (elisp-pass-if '(and #t) "#t")
300          (elisp-pass-if '(and nil) "#nil")
301          (elisp-pass-if '(and t) "#t")
302          (elisp-pass-if '(and) "#t")
303          (elisp-pass-if '(cond (nil t) (t 3)) "3")
304          (elisp-pass-if '(cond (nil t) (t)) "#t")
305          (elisp-pass-if '(cond (nil)) "#nil")
306          (elisp-pass-if '(cond) "#nil")
307          (elisp-pass-if '(if #f 'a 'b) "b")
308          (elisp-pass-if '(if #t 'a 'b) "a")
309          (elisp-pass-if '(if '() 'a 'b) "b")
310          (elisp-pass-if '(if nil 'a 'b) "b")
311          (elisp-pass-if '(if nil 1 2 3 4) "4")
312          (elisp-pass-if '(if nil 1 2) "2")
313          (elisp-pass-if '(if nil 1) "#nil")
314          (elisp-pass-if '(if t 1 2) "1")
315          (elisp-pass-if '(if t 1) "1")
316          (elisp-pass-if '(let (a) a) "#nil")
317          (elisp-pass-if '(let* (a) a) "#nil")
318          (elisp-pass-if '(let* ((a 1) (b (* a 2))) b) "2")
319          (elisp-pass-if '(memq '() '(())) "(())")
320          (elisp-pass-if '(memq '() '(nil)) "(#nil)")
321          (elisp-pass-if '(memq '() '(t)) "#nil")
322          (elisp-pass-if '(memq nil '(())) "(())")
323          (elisp-pass-if '(memq nil '(nil)) "(#nil)")
324          (elisp-pass-if '(memq nil (list nil)) "(#nil)")
325          (elisp-pass-if '(null '#f) "#t")
326          (elisp-pass-if '(null '()) "#t")
327          (elisp-pass-if '(null 'nil) "#t")
328          (elisp-pass-if '(null nil) "#t")
329          (elisp-pass-if '(or 1 2 3) "1")
330          (elisp-pass-if '(or nil t nil) "#t")
331          (elisp-pass-if '(or nil) "#nil")
332          (elisp-pass-if '(or t nil t) "#t")
333          (elisp-pass-if '(or t) "#t")
334          (elisp-pass-if '(or) "#nil")
335          (elisp-pass-if '(prog1 1 2 3) "1")
336          (elisp-pass-if '(prog2 1 2 3) "2")
337          (elisp-pass-if '(progn 1 2 3) "3")
338          (elisp-pass-if '(while nil 1) "#nil")
339          
340          (elisp-pass-if '(defun testf (x y &optional o &rest r) (list x y o r)) "testf")
341          (elisp-pass-if '(testf 1 2) "(1 2 #nil #nil)")
342          (elisp-pass-if '(testf 1 2 3 4 5 56) "(1 2 3 (4 5 56))")
343          ;; NB `lambda' in Emacs is self-quoting, but that's only after
344          ;; loading the macro definition of lambda in subr.el.
345          (elisp-pass-if '(function (lambda (x y &optional o &rest r) (list x y o r))) "(lambda (x y &optional o &rest r) (list x y o r))")
346          (elisp-pass-if '(funcall (lambda (x y &optional o &rest r) (list x y o r)) 1 2 3 4) "(1 2 3 (4))")
347          (elisp-pass-if '(apply (lambda (x y &optional o &rest r) (list x y o r)) 1 2 3 nil) "(1 2 3 #nil)")
348    
349          (elisp-pass-if '(setq x 3) "3")
350          (elisp-pass-if '(defvar x 4) "x")
351          (elisp-pass-if 'x "3")
352    
353          ))
354    
355  ;;; elisp.test ends here  ;;; elisp.test ends here

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26