diff options
| author | (unmatched-parenthesis ew syntax <paren@disroot.org> | 2023-04-28 20:19:05 +0100 |
|---|---|---|
| committer | Josselin Poiret <dev@jpoiret.xyz> | 2023-06-04 10:59:25 +0200 |
| commit | 4cd529362108086eeec25d4d465261415cff45b3 (patch) | |
| tree | cbb0b3e462513d52260f8be7bcc8f2176fbf3840 /tests/records.scm | |
| parent | e6dc1d399663b9fab30ded8bcb716a5b1dbf8743 (diff) | |
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.scm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/records.scm b/tests/records.scm index 4f0aeb39035..8ee306bddc5 100644 --- a/tests/records.scm +++ b/tests/records.scm | |||
| @@ -590,4 +590,16 @@ Description: 1st line, | |||
| 590 | (match-record rec <with-thunked> (normal thunked) | 590 | (match-record rec <with-thunked> (normal thunked) |
| 591 | (list normal thunked))))) | 591 | (list normal thunked))))) |
| 592 | 592 | ||
| 593 | (test-equal "match-record-lambda" | ||
| 594 | '("thing: foo" "thing: bar") | ||
| 595 | (begin | ||
| 596 | (define-record-type* <with-text> with-text make-with-text | ||
| 597 | with-text? | ||
| 598 | (text with-text-text)) | ||
| 599 | |||
| 600 | (map (match-record-lambda <with-text> (text) | ||
| 601 | (string-append "thing: " text)) | ||
| 602 | (list (with-text (text "foo")) | ||
| 603 | (with-text (text "bar")))))) | ||
| 604 | |||
| 593 | (test-end) | 605 | (test-end) |
