aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-07-01 12:08:22 +0200
committerLudovic Courtès <ludo@gnu.org>2022-07-01 12:10:29 +0200
commit741895676b124a8a9a6656a54b5b58fd35d8e0f9 (patch)
tree69cd635de4e74aba4462de4288d7e13c9accbf6b /tests
parent0dab106a6af36eaebfd533d3e38c1275deb85935 (diff)
downloadguix-741895676b124a8a9a6656a54b5b58fd35d8e0f9.tar.gz
guix-741895676b124a8a9a6656a54b5b58fd35d8e0f9.zip
tests: Add sanitizer test.
* tests/records.scm ("define-record-type* & sanitize without default value"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/records.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/records.scm b/tests/records.scm
index d014e7a995..00c58b0736 100644
--- a/tests/records.scm
+++ b/tests/records.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2016, 2018-2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -300,6 +300,15 @@
(string=? (foo-bar r) "baz!")
(equal? s r)))))
+(test-equal "define-record-type* & sanitize without default value"
+ 42
+ (begin
+ (define-record-type* <foo> foo make-foo
+ foo?
+ (bar foo-bar (sanitize 1+)))
+
+ (foo-bar (foo (bar 41)))))
+
(test-assert "define-record-type* & sanitize & thunked"
(let ((sanitized 0))
(define-record-type* <foo> foo make-foo
@@ -321,6 +330,7 @@
(let ((r (foo (inherit q))))
(and (string=? (foo-bar r) "baz!")
(= sanitized 2))))))))) ;no re-sanitization
+
(test-assert "define-record-type* & wrong field specifier"
(let ((exp '(begin
(define-record-type* <foo> foo make-foo