mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
style: '-S format' canonicalizes comments.
* guix/scripts/style.scm (canonicalize-comment): New procedure. (pretty-print-with-comments): Add #:format-comment. and honor it. (object->string*): Add 'args' and honor them. (format-package-definition): Pass #:format-comment to 'object->string*'. * tests/style.scm ("pretty-print-with-comments, canonicalize-comment"): New test.
This commit is contained in:
parent
c4fe13c294
commit
5d9a5e2301
2 changed files with 56 additions and 8 deletions
|
@ -485,6 +485,31 @@ mnopqrstuvwxyz.\")"
|
|||
'(#:phases %standard-phases
|
||||
#:tests? #f)))")
|
||||
|
||||
(test-equal "pretty-print-with-comments, canonicalize-comment"
|
||||
"\
|
||||
(list abc
|
||||
;; Not a margin comment.
|
||||
;; Ditto.
|
||||
;;
|
||||
;; There's a blank line above.
|
||||
def ;margin comment
|
||||
ghi)"
|
||||
(let ((sexp (call-with-input-string
|
||||
"\
|
||||
(list abc
|
||||
;Not a margin comment.
|
||||
;;; Ditto.
|
||||
;;;;;
|
||||
; There's a blank line above.
|
||||
def ;; margin comment
|
||||
ghi)"
|
||||
read-with-comments)))
|
||||
(call-with-output-string
|
||||
(lambda (port)
|
||||
(pretty-print-with-comments port sexp
|
||||
#:format-comment
|
||||
canonicalize-comment)))))
|
||||
|
||||
(test-end)
|
||||
|
||||
;; Local Variables:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue