1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

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!
This commit is contained in:
Ludovic Courtès 2009-08-13 16:16:08 +02:00
parent 16f451f308
commit d785171115

View file

@ -33,21 +33,23 @@
(pass-if "redefinition" (pass-if "redefinition"
;; In this case the locally-bound `round' must have the same value as the ;; 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. ;; imported `round'. See the same test in `syntax.test' for details.
(let ((o1 (compile '(define round round))) (begin
(o2 (compile '(eq? round (@@ (guile) round))))) (compile '(define round round))
o2)) (compile '(eq? round (@@ (guile) round)))))
(pass-if "compile in current module" (pass-if "compile in current module"
(let ((o1 (compile '(define-macro (foo) 'bar))) (let ((o (begin
(o2 (compile '(let ((bar 'ok)) (foo))))) (compile '(define-macro (foo) 'bar))
(compile '(let ((bar 'ok)) (foo))))))
(and (module-ref (current-module) 'foo) (and (module-ref (current-module) 'foo)
(eq? o2 'ok)))) (eq? o 'ok))))
(pass-if "compile in fresh module" (pass-if "compile in fresh module"
(let* ((m (let ((m (make-module))) (let* ((m (let ((m (make-module)))
(beautify-user-module! m) (beautify-user-module! m)
m)) m))
(o1 (compile '(define-macro (foo) 'bar) #:env m)) (o (begin
(o2 (compile '(let ((bar 'ok)) (foo)) #:env m))) (compile '(define-macro (foo) 'bar) #:env m)
(compile '(let ((bar 'ok)) (foo)) #:env m))))
(and (module-ref m 'foo) (and (module-ref m 'foo)
(eq? o2 'ok))))) (eq? o 'ok)))))