mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02: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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user