1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 12:20:26 +02:00
guile/test-suite/tests/compiler.test
Ludovic Courtès d785171115 compiler.test: Enforce evaluation order.
* test-suite/tests/compiler.test ("psyntax")["redefinition", "compile in
  current module", "compile in fresh module"]: Use `begin' to enforce
  evaluation order.  Thanks Andy!
2009-08-13 16:16:08 +02:00

55 lines
2 KiB
Scheme
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;;; compiler.test --- tests for the compiler -*- scheme -*-
;;;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
(define-module (test-suite tests compiler)
:use-module (test-suite lib)
:use-module (test-suite guile-test)
:use-module (system base compile))
(with-test-prefix "basic"
(pass-if "compile to value"
(equal? (compile 1) 1)))
(with-test-prefix "psyntax"
(pass-if "redefinition"
;; In this case the locally-bound `round' must have the same value as the
;; imported `round'. See the same test in `syntax.test' for details.
(begin
(compile '(define round round))
(compile '(eq? round (@@ (guile) round)))))
(pass-if "compile in current module"
(let ((o (begin
(compile '(define-macro (foo) 'bar))
(compile '(let ((bar 'ok)) (foo))))))
(and (module-ref (current-module) 'foo)
(eq? o 'ok))))
(pass-if "compile in fresh module"
(let* ((m (let ((m (make-module)))
(beautify-user-module! m)
m))
(o (begin
(compile '(define-macro (foo) 'bar) #:env m)
(compile '(let ((bar 'ok)) (foo)) #:env m))))
(and (module-ref m 'foo)
(eq? o 'ok)))))