mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
import/utils: beautify-description: Validate argument.
* guix/import/utils.scm (beautify-description): Fix broken check for non-strings. Add a check for empty strings. * tests/import-utils.scm: Add two tests. Change-Id: Idf86df02aeb850fcc8808b7c9251082c1f816656 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
47a5cd9f9c
commit
0772d36076
2 changed files with 14 additions and 4 deletions
|
@ -331,9 +331,9 @@ are replaced with dashes."
|
|||
"Improve the package DESCRIPTION by turning a beginning sentence fragment into
|
||||
a proper sentence and by using two spaces between sentences, and wrap lines at
|
||||
LENGTH characters."
|
||||
(unless (string? description)
|
||||
(G_ "This package lacks a description. Run \
|
||||
\"info '(guix) Synopses and Descriptions'\" for more information."))
|
||||
(if (or (not (string? description)) (string=? (string-trim-both description) ""))
|
||||
(G_ "This package lacks a description. Run \
|
||||
\"info '(guix) Synopses and Descriptions'\" for more information.")
|
||||
|
||||
(let* ((fix-word
|
||||
(lambda (word)
|
||||
|
@ -410,7 +410,7 @@ LENGTH characters."
|
|||
". "
|
||||
". ")))
|
||||
'post)
|
||||
length)))
|
||||
length))))
|
||||
|
||||
(define (beautify-synopsis synopsis)
|
||||
"Improve the package SYNOPSIS."
|
||||
|
|
|
@ -31,6 +31,16 @@
|
|||
|
||||
(test-begin "import-utils")
|
||||
|
||||
(test-equal "beautify-description: empty string"
|
||||
"This package lacks a description. Run \
|
||||
\"info '(guix) Synopses and Descriptions'\" for more information."
|
||||
(beautify-description ""))
|
||||
|
||||
(test-equal "beautify-description: not a string"
|
||||
"This package lacks a description. Run \
|
||||
\"info '(guix) Synopses and Descriptions'\" for more information."
|
||||
(beautify-description '()))
|
||||
|
||||
(test-equal "beautify-description: use double spacing"
|
||||
"\
|
||||
Trust me Mr. Hendrix, M. Night Shyamalan et al. \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue