summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-06-27 23:40:12 +0200
committerLudovic Courtès <ludo@gnu.org>2012-06-27 23:40:12 +0200
commit72d869634bd22d978af13f5a8c89ddff27140422 (patch)
tree17da8e80b8bcf56c4ad7c3058e81846c8b719915 /tests
parent0d56a551bf5f1cf94f59cf508b3820bcc8fd8050 (diff)
Add `define-record-type*'.
* guix/utils.scm (define-record-type*): New macro. * tests/utils.scm ("define-record-type*"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index b3c7fefa39..83a78b7a78 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -26,7 +26,8 @@
#:use-module (rnrs bytevectors)
#:use-module (rnrs io ports)
#:use-module (ice-9 rdelim)
- #:use-module (ice-9 popen))
+ #:use-module (ice-9 popen)
+ #:use-module (ice-9 match))
(test-begin "utils")
@@ -98,6 +99,19 @@
(equal? nix (gnu-triplet->nix-system gnu)))
gnu nix))))
+(test-assert "define-record-type*"
+ (begin
+ (define-record-type* <foo> foo make-foo
+ foo?
+ (bar foo-bar)
+ (baz foo-baz (default (+ 40 2))))
+ (and (match (foo (bar 1) (baz 2))
+ (($ <foo> 1 2) #t))
+ (match (foo (baz 2) (bar 1))
+ (($ <foo> 1 2) #t))
+ (match (foo (bar 1))
+ (($ <foo> 1 42) #t)))))
+
(test-end)