diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2019-01-23 12:08:27 +0100 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2019-01-23 12:08:27 +0100 |
commit | 5aaef5c5decbf4dd43dfd1bb8d2a7d9e049a8580 (patch) | |
tree | 9f4ce853b9bc2d2b5433d8f0bec18749e93d8ba3 /tests/records.scm | |
parent | 38f77be464b0b6ca76105d5f0a1b5e55fd694036 (diff) | |
parent | 6a6799b27af8646da112d51bedb8e5ff6158e425 (diff) |
Merge branch 'master' into staging
Diffstat (limited to 'tests/records.scm')
-rw-r--r-- | tests/records.scm | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/records.scm b/tests/records.scm index 09ada70c2d..d9469a78bd 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 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -288,6 +288,30 @@ (and (string-match "extra.*initializer.*baz" message) (eq? proc 'foo))))) +(test-assert "define-record-type* & duplicate initializers" + (let ((exp '(begin + (define-record-type* <foo> foo make-foo + foo? + (bar foo-bar (default 42))) + + (foo (bar 1) + (bar 2)))) + (loc (current-source-location))) ;keep this alignment! + (catch 'syntax-error + (lambda () + (eval exp (test-module)) + #f) + (lambda (key proc message location form . args) + (and (string-match "duplicate.*initializer" message) + (eq? proc 'foo) + + ;; Make sure the location is that of the field specifier. + (lset= equal? + (pk 'expected-loc + `((line . ,(- (assq-ref loc 'line) 1)) + ,@(alist-delete 'line loc))) + (pk 'actual-loc location))))))) + (test-assert "ABI checks" (let ((module (test-module))) (eval '(begin |