mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
tests: configuration: Add a test to cover 'unset regression.
The regression was introduced with a2b89a3319
,
and introduce a risk that 'unset leaks to serialized configuration files.
* tests/services/configuration.scm (maybe-symbol): New type.
(config-with-maybe-symbol): New configuration.
("symbol maybe value serialization, unspecified"): New test.
Reported-by: Attila Lendvai <attila@lendvai.name>
This commit is contained in:
parent
02b69362cb
commit
97cb43e732
1 changed files with 19 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||
;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
|
||||
;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
|
@ -141,6 +141,24 @@ (define (config-with-maybe-number->string x)
|
|||
(config-with-maybe-number
|
||||
(port 42))))
|
||||
|
||||
(define (serialize-symbol name value)
|
||||
(format #f "~a=~a~%" name value))
|
||||
|
||||
(define-maybe symbol)
|
||||
|
||||
(define-configuration config-with-maybe-symbol
|
||||
(protocol maybe-symbol ""))
|
||||
|
||||
;;; Maybe symbol values are currently seen as serializable, because the
|
||||
;;; unspecified value is 'unset, which is a symbol itself.
|
||||
;;; TODO: Remove expected fail marker after resolution.
|
||||
(test-expect-fail 1)
|
||||
(test-equal "symbol maybe value serialization, unspecified"
|
||||
""
|
||||
(gexp->approximate-sexp
|
||||
(serialize-configuration (config-with-maybe-symbol)
|
||||
config-with-maybe-symbol-fields)))
|
||||
|
||||
(define-maybe/no-serialization string)
|
||||
|
||||
(define-configuration config-with-maybe-string/no-serialization
|
||||
|
|
Loading…
Reference in a new issue