1 ;;;; compiler.test --- tests for the compiler -*- scheme -*-
2 ;;;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1999, 2001, 2006 Free Software Foundation, Inc.
4 ;;;; This library is free software; you can redistribute it and/or
5 ;;;; modify it under the terms of the GNU Lesser General Public
6 ;;;; License as published by the Free Software Foundation; either
7 ;;;; version 2.1 of the License, or (at your option) any later version.
9 ;;;; This library is distributed in the hope that it will be useful,
10 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ;;;; Lesser General Public License for more details.
14 ;;;; You should have received a copy of the GNU Lesser General Public
15 ;;;; License along with this library; if not, write to the Free Software
16 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 (define-module (test-suite tests compiler)
19 :use-module (test-suite lib)
20 :use-module (test-suite guile-test)
21 :use-module (system vm program))
24 (with-test-prefix "environments"
26 (pass-if "compile-time-environment in evaluator"
27 (eq? (primitive-eval '(compile-time-environment)) #f))
29 (pass-if "compile-time-environment in compiler"
30 (equal? (compile '(compile-time-environment))
31 (cons (current-module)
35 '(let ((x 0)) (set! x 1) (compile-time-environment)))))
36 (pass-if "compile-time-environment in compiler, heap-allocated var"
38 (cons (current-module)
39 (cons '((x . 0)) '(1)))))
41 ;; fixme: compiling with #t or module
42 (pass-if "recompiling with environment"
43 (equal? ((compile '(lambda () x) env))
46 (pass-if "recompiling with environment/2"
47 (equal? ((compile '(lambda () (set! x (1+ x)) x) env))
50 (pass-if "recompiling with environment/3"
51 (equal? ((compile '(lambda () x) env))
55 (pass-if "compile environment is #f"
56 (equal? ((compile '(lambda () 10)))
59 (pass-if "compile environment is a module"
60 (equal? ((compile '(lambda () 10) (current-module)))