summary refs log tree commit diff
path: root/tests/records.scm
diff options
context:
space:
mode:
author(unmatched-parenthesis ew syntax <paren@disroot.org>2023-04-28 20:19:05 +0100
committerJosselin Poiret <dev@jpoiret.xyz>2023-06-04 10:59:25 +0200
commit4cd529362108086eeec25d4d465261415cff45b3 (patch)
treecbb0b3e462513d52260f8be7bcc8f2176fbf3840 /tests/records.scm
parente6dc1d399663b9fab30ded8bcb716a5b1dbf8743 (diff)
downloadguix-4cd529362108086eeec25d4d465261415cff45b3.tar.gz
records: Add MATCH-RECORD-LAMBDA.
* guix/records.scm (match-record-lambda): New syntax.
* tests/records.scm ("match-record-lambda"): New test.

Signed-off-by: Josselin Poiret <dev@jpoiret.xyz>
Diffstat (limited to 'tests/records.scm')
-rw-r--r--tests/records.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/records.scm b/tests/records.scm
index 4f0aeb3903..8ee306bddc 100644
--- a/tests/records.scm
+++ b/tests/records.scm
@@ -590,4 +590,16 @@ Description: 1st line,
       (match-record rec <with-thunked> (normal thunked)
         (list normal thunked)))))
 
+(test-equal "match-record-lambda"
+  '("thing: foo" "thing: bar")
+  (begin
+    (define-record-type* <with-text> with-text make-with-text
+      with-text?
+      (text with-text-text))
+
+    (map (match-record-lambda <with-text> (text)
+           (string-append "thing: " text))
+         (list (with-text (text "foo"))
+               (with-text (text "bar"))))))
+
 (test-end)