aboutsummaryrefslogtreecommitdiff
path: root/tests/records.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-07-17 16:45:45 +0200
committerLudovic Courtès <ludo@gnu.org>2014-07-17 16:45:45 +0200
commita1906758c31036c30f8c11703daa4202adde8dac (patch)
tree6f883bda37ee9e445792e7938b211c87af6f88f5 /tests/records.scm
parentb1353e7a6baf15e6e1db79063c01f4b07b6d4e06 (diff)
downloadguix-a1906758c31036c30f8c11703daa4202adde8dac.tar
guix-a1906758c31036c30f8c11703daa4202adde8dac.tar.gz
records: Report unknown field names in inheriting forms.
* guix/records.scm (define-record-type*)[record-inheritance]: Check for unexpected field names. * tests/records.scm ("define-record-type* with let* behavior"): Return #t, not *unspecified*. ("define-record-type* & inherit & extra initializers"): New test.
Diffstat (limited to 'tests/records.scm')
-rw-r--r--tests/records.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/records.scm b/tests/records.scm
index 23c0786e9e..e90d33d15d 100644
--- a/tests/records.scm
+++ b/tests/records.scm
@@ -58,7 +58,7 @@
(match (bar (x 7) (z (* x 3)))
(($ <bar> 7 42 21)))
(match (bar (z 21) (x (/ z 3)))
- (($ <bar> 7 42 21))))))
+ (($ <bar> 7 42 21) #t)))))
(test-assert "define-record-type* & inherit"
(begin
@@ -171,6 +171,21 @@
(and (string-match "extra.*initializer.*baz" message)
(eq? proc 'foo)))))
+(test-assert "define-record-type* & inherit & extra initializers"
+ (catch 'syntax-error
+ (lambda ()
+ (eval '(begin
+ (define-record-type* <foo> foo make-foo
+ foo?
+ (bar foo-bar (default 42)))
+
+ (foo (inherit (foo)) (baz 'what?)))
+ (test-module))
+ #f)
+ (lambda (key proc message location form . args)
+ (and (string-match "extra.*initializer.*baz" message)
+ (eq? proc 'foo)))))
+
(test-equal "recutils->alist"
'((("Name" . "foo")
("Version" . "0.1")