diff options
author | Mark H Weaver <mhw@netris.org> | 2012-11-09 23:02:44 -0500 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2012-11-09 23:02:44 -0500 |
commit | dfba1025e56245f55bdda85639e5b59682e7ad47 (patch) | |
tree | a7bef3f7fd7cce572f16addbb1b2f1d1d673a726 | |
parent | ce6508531c2fb0a7fb61b3594bc347219ff093cc (diff) | |
download | guile-dfba1025e56245f55bdda85639e5b59682e7ad47.tar.gz |
Fix non-toplevel srfi-9 compile-time error tests to actually be non-toplevel.
* test-suite/tests/srfi-9.test: Move non-toplevel record definitions to be
within the expression passed to 'compile'.
-rw-r--r-- | test-suite/tests/srfi-9.test | 160 |
1 files changed, 88 insertions, 72 deletions
diff --git a/test-suite/tests/srfi-9.test b/test-suite/tests/srfi-9.test index 7d4f7d9f1..d1f15558c 100644 --- a/test-suite/tests/srfi-9.test +++ b/test-suite/tests/srfi-9.test @@ -493,47 +493,55 @@ '(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" @@ -542,27 +550,31 @@ ((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 @@ -572,27 +584,31 @@ ((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" |