summaryrefslogtreecommitdiff
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)
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 23c0786e9ec..e90d33d15d7 100644
--- a/tests/records.scm
+++ b/tests/records.scm
@@ -58,7 +58,7 @@
58 (match (bar (x 7) (z (* x 3))) 58 (match (bar (x 7) (z (* x 3)))
59 (($ <bar> 7 42 21))) 59 (($ <bar> 7 42 21)))
60 (match (bar (z 21) (x (/ z 3))) 60 (match (bar (z 21) (x (/ z 3)))
61 (($ <bar> 7 42 21)))))) 61 (($ <bar> 7 42 21) #t)))))
62 62
63(test-assert "define-record-type* & inherit" 63(test-assert "define-record-type* & inherit"
64 (begin 64 (begin
@@ -171,6 +171,21 @@
171 (and (string-match "extra.*initializer.*baz" message) 171 (and (string-match "extra.*initializer.*baz" message)
172 (eq? proc 'foo))))) 172 (eq? proc 'foo)))))
173 173
174(test-assert "define-record-type* & inherit & extra initializers"
175 (catch 'syntax-error
176 (lambda ()
177 (eval '(begin
178 (define-record-type* <foo> foo make-foo
179 foo?
180 (bar foo-bar (default 42)))
181
182 (foo (inherit (foo)) (baz 'what?)))
183 (test-module))
184 #f)
185 (lambda (key proc message location form . args)
186 (and (string-match "extra.*initializer.*baz" message)
187 (eq? proc 'foo)))))
188
174(test-equal "recutils->alist" 189(test-equal "recutils->alist"
175 '((("Name" . "foo") 190 '((("Name" . "foo")
176 ("Version" . "0.1") 191 ("Version" . "0.1")