diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/records.scm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/records.scm b/tests/records.scm index 9c071334d50..57a21d2effc 100644 --- a/tests/records.scm +++ b/tests/records.scm | |||
| @@ -302,6 +302,26 @@ | |||
| 302 | => | 302 | => |
| 303 | (,(foo-bar child) ,(foo-baz child)))))) | 303 | (,(foo-bar child) ,(foo-baz child)))))) |
| 304 | 304 | ||
| 305 | (test-assert "define-record-type* & inherited value shadowing" | ||
| 306 | (let ((exp '(begin | ||
| 307 | (define-record-type* <foo> foo make-foo | ||
| 308 | foo? | ||
| 309 | (bar foo-bar) | ||
| 310 | (baz foo-baz (thunked))) | ||
| 311 | |||
| 312 | (let ((x (foo (bar 1) (baz 2))) | ||
| 313 | (baz 123)) | ||
| 314 | ;; Below, the 'baz' binding for the inherited field value | ||
| 315 | ;; shadows the 'baz' above, which should trigger a warning. | ||
| 316 | (foo (inherit x) | ||
| 317 | (baz (* baz 2))))))) | ||
| 318 | (string-contains | ||
| 319 | (call-with-output-string | ||
| 320 | (lambda (port) | ||
| 321 | (parameterize ((current-warning-port port)) | ||
| 322 | (eval exp (test-module))))) | ||
| 323 | "shadows local variable"))) | ||
| 324 | |||
| 305 | (test-assert "define-record-type* & delayed" | 325 | (test-assert "define-record-type* & delayed" |
| 306 | (begin | 326 | (begin |
| 307 | (define-record-type* <foo> foo make-foo | 327 | (define-record-type* <foo> foo make-foo |
