From 72d869634bd22d978af13f5a8c89ddff27140422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 27 Jun 2012 23:40:12 +0200 Subject: Add `define-record-type*'. * guix/utils.scm (define-record-type*): New macro. * tests/utils.scm ("define-record-type*"): New test. --- tests/utils.scm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'tests/utils.scm') 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 make-foo + foo? + (bar foo-bar) + (baz foo-baz (default (+ 40 2)))) + (and (match (foo (bar 1) (baz 2)) + (($ 1 2) #t)) + (match (foo (baz 2) (bar 1)) + (($ 1 2) #t)) + (match (foo (bar 1)) + (($ 1 42) #t))))) + (test-end) -- cgit v1.2.3