Fix non-toplevel srfi-9 compile-time error tests to actually be non-toplevel.
authorMark H Weaver <mhw@netris.org>
Sat, 10 Nov 2012 04:02:44 +0000 (23:02 -0500)
committerMark H Weaver <mhw@netris.org>
Sat, 10 Nov 2012 04:02:44 +0000 (23:02 -0500)
* test-suite/tests/srfi-9.test: Move non-toplevel record definitions to be
  within the expression passed to 'compile'.

test-suite/tests/srfi-9.test

index 7d4f7d9..d1f1555 100644 (file)
         '(syntax-error set-fields "unknown getter"
                        (set-fields s ((bar-i foo-x) 1) ((blah) 3))
                        blah)
-      (let ()
-        (define-immutable-record-type foo (make-foo x) foo?
-          (x foo-x)
-          (y foo-y set-foo-y)
-          (z foo-z set-foo-z))
-
-        (define-immutable-record-type :bar (make-bar i j) bar?
-          (i bar-i)
-          (j bar-j set-bar-j))
-
-        (catch 'syntax-error
-          (lambda ()
-            (compile '(let ((s (make-bar (make-foo 5) 2)))
-                        (set-fields s ((bar-i foo-x) 1) ((blah) 3)))
-                     #:env (current-module))
-            #f)
-          (lambda (key whom what src form subform)
-            (list key whom what form subform)))))
+      (catch 'syntax-error
+        (lambda ()
+          (compile '(let ()
+                      (define-immutable-record-type foo
+                        (make-foo x)
+                        foo?
+                        (x foo-x)
+                        (y foo-y set-foo-y)
+                        (z foo-z set-foo-z))
+
+                      (define-immutable-record-type :bar
+                        (make-bar i j)
+                        bar?
+                        (i bar-i)
+                        (j bar-j set-bar-j))
+
+                      (let ((s (make-bar (make-foo 5) 2)))
+                        (set-fields s ((bar-i foo-x) 1) ((blah) 3))))
+                   #:env (current-module))
+          #f)
+        (lambda (key whom what src form subform)
+          (list key whom what form subform))))
 
     (pass-if-equal "set-fields with unknown second getter"
         '(syntax-error set-fields "unknown getter"
                        (set-fields s ((bar-i foo-x) 1) ((blah) 3))
                        blah)
-      (let ()
-        (define-immutable-record-type foo (make-foo x) foo?
-          (x foo-x)
-          (y foo-y set-foo-y)
-          (z foo-z set-foo-z))
-
-        (define-immutable-record-type :bar (make-bar i j) bar?
-          (i bar-i)
-          (j bar-j set-bar-j))
-
-        (catch 'syntax-error
-          (lambda ()
-            (compile '(let ((s (make-bar (make-foo 5) 2)))
-                        (set-fields s ((bar-i foo-x) 1) ((blah) 3)))
-                     #:env (current-module))
-            #f)
-          (lambda (key whom what src form subform)
-            (list key whom what form subform)))))
+      (catch 'syntax-error
+        (lambda ()
+          (compile '(let ()
+                      (define-immutable-record-type foo
+                        (make-foo x)
+                        foo?
+                        (x foo-x)
+                        (y foo-y set-foo-y)
+                        (z foo-z set-foo-z))
+
+                      (define-immutable-record-type :bar
+                        (make-bar i j)
+                        bar?
+                        (i bar-i)
+                        (j bar-j set-bar-j))
+
+                      (let ((s (make-bar (make-foo 5) 2)))
+                        (set-fields s ((bar-i foo-x) 1) ((blah) 3))))
+                   #:env (current-module))
+          #f)
+        (lambda (key whom what src form subform)
+          (list key whom what form subform))))
 
     (pass-if-equal "set-fields with duplicate field path"
         '(syntax-error set-fields "duplicate field path"
                          ((bar-i foo-z) 2)
                          ((bar-i foo-x) 3))
                        (bar-i foo-x))
-      (let ()
-        (define-immutable-record-type foo (make-foo x) foo?
-          (x foo-x)
-          (y foo-y set-foo-y)
-          (z foo-z set-foo-z))
-
-        (define-immutable-record-type :bar (make-bar i j) bar?
-          (i bar-i)
-          (j bar-j set-bar-j))
-
-        (catch 'syntax-error
-          (lambda ()
-            (compile '(let ((s (make-bar (make-foo 5) 2)))
+      (catch 'syntax-error
+        (lambda ()
+          (compile '(let ()
+                      (define-immutable-record-type foo
+                        (make-foo x)
+                        foo?
+                        (x foo-x)
+                        (y foo-y set-foo-y)
+                        (z foo-z set-foo-z))
+
+                      (define-immutable-record-type :bar
+                        (make-bar i j)
+                        bar?
+                        (i bar-i)
+                        (j bar-j set-bar-j))
+
+                      (let ((s (make-bar (make-foo 5) 2)))
                         (set-fields s
                           ((bar-i foo-x) 1)
                           ((bar-i foo-z) 2)
-                          ((bar-i foo-x) 3)))
-                     #:env (current-module))
-            #f)
-          (lambda (key whom what src form subform)
-            (list key whom what form subform)))))
+                          ((bar-i foo-x) 3))))
+                   #:env (current-module))
+          #f)
+        (lambda (key whom what src form subform)
+          (list key whom what form subform))))
 
     (pass-if-equal "set-fields with one path as a prefix of another"
         '(syntax-error set-fields
                          ((bar-i foo-z) 2)
                          ((bar-i) 3))
                        (bar-i))
-      (let ()
-        (define-immutable-record-type foo (make-foo x) foo?
-          (x foo-x)
-          (y foo-y set-foo-y)
-          (z foo-z set-foo-z))
-
-        (define-immutable-record-type :bar (make-bar i j) bar?
-          (i bar-i)
-          (j bar-j set-bar-j))
-
-        (catch 'syntax-error
-          (lambda ()
-            (compile '(let ((s (make-bar (make-foo 5) 2)))
+      (catch 'syntax-error
+        (lambda ()
+          (compile '(let ()
+                      (define-immutable-record-type foo
+                        (make-foo x)
+                        foo?
+                        (x foo-x)
+                        (y foo-y set-foo-y)
+                        (z foo-z set-foo-z))
+
+                      (define-immutable-record-type :bar
+                        (make-bar i j)
+                        bar?
+                        (i bar-i)
+                        (j bar-j set-bar-j))
+
+                      (let ((s (make-bar (make-foo 5) 2)))
                         (set-fields s
                           ((bar-i foo-x) 1)
                           ((bar-i foo-z) 2)
-                          ((bar-i) 3)))
-                     #:env (current-module))
-            #f)
-          (lambda (key whom what src form subform)
-            (list key whom what form subform)))))))
+                          ((bar-i) 3))))
+                   #:env (current-module))
+          #f)
+        (lambda (key whom what src form subform)
+          (list key whom what form subform))))))
 
 (with-test-prefix "record compatibility"