;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021-2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
(string-append directory "/my-packages.scm"))
;; Run as a separate process to make sure FILE is reloaded.
- (system* "guix" "style" "-L" directory "my-coreutils")
+ (system* "guix" "style" "-L" directory "-S" "inputs"
+ "my-coreutils")
(system* "cat" file)
(load file)
(lambda (port)
(read-lines port line count)))))
-(define-syntax-rule (test-pretty-print str args ...)
- "Test equality after a round-trip where STR is passed to
-'read-with-comments' and the resulting sexp is then passed to
-'pretty-print-with-comments'."
- (test-equal str
- (call-with-output-string
- (lambda (port)
- (let ((exp (call-with-input-string str
- read-with-comments)))
- (pretty-print-with-comments port exp args ...))))))
-
\f
(test-begin "style")
(string-append directory "/my-packages.scm"))
(system* "guix" "style" "-L" directory "my-coreutils"
+ "-S" "inputs"
"--input-simplification=safe")
(load file)
(string-append directory "/my-packages.scm"))
(system* "guix" "style" "-L" directory "my-coreutils"
+ "-S" "inputs"
"--input-simplification=safe")
(load file)
" ;another one\n")))
(system* "cat" file)
- (system* "guix" "style" "-L" directory "my-coreutils")
+ (system* "guix" "style" "-L" directory "-S" "inputs"
+ "my-coreutils")
(load file)
(list (package-inputs (@ (my-packages) my-coreutils))
" ;margin comment\n")))
(system* "cat" file)
- (system* "guix" "style" "-L" directory "my-coreutils")
+ (system* "guix" "style" "-L" directory "-S" "inputs"
+ "my-coreutils")
(load file)
(list (package-inputs (@ (my-packages) my-coreutils))
((",gmp\\)(.*)$" _ rest)
(string-append ",gmp)\n ;; line comment!\n" rest)))
- (system* "guix" "style" "-L" directory "my-coreutils")
+ (system* "guix" "style" "-L" directory "-S" "inputs"
+ "my-coreutils")
(load file)
(list (package-inputs (@ (my-packages) my-coreutils))
(substitute* file
((",gmp\\)(.*)$" _ rest)
- (string-append ",gmp) ;margin comment\n" rest))
+ (string-append ",gmp) ;margin comment" rest))
((",acl\\)(.*)$" _ rest)
- (string-append ",acl) ;another one\n" rest)))
+ (string-append ",acl) ;another one" rest)))
- (system* "guix" "style" "-L" directory "my-coreutils")
+ (system* "guix" "style" "-L" directory "-S" "inputs"
+ "my-coreutils")
(load file)
(list (package-inputs (@ (my-packages) my-coreutils))
(read-package-field (@ (my-packages) my-coreutils) 'inputs 4)))))
-(test-pretty-print "(list 1 2 3 4)")
-(test-pretty-print "(list 1
- 2
- 3
- 4)"
- #:long-list 3
- #:indent 20)
-(test-pretty-print "\
-(list abc
- def)"
- #:max-width 11)
-(test-pretty-print "\
-(#:foo
- #:bar)"
- #:max-width 10)
-
-(test-pretty-print "\
-(#:first 1
- #:second 2
- #:third 3)")
-
-(test-pretty-print "\
-((x
- 1)
- (y
- 2)
- (z
- 3))"
- #:max-width 3)
-
-(test-pretty-print "\
-(let ((x 1)
- (y 2)
- (z 3)
- (p 4))
- (+ x y))"
- #:max-width 11)
-
-(test-pretty-print "\
-(lambda (x y)
- ;; This is a procedure.
- (let ((z (+ x y)))
- (* z z)))")
-
-(test-pretty-print "\
-#~(string-append #$coreutils \"/bin/uname\")")
-
-(test-pretty-print "\
-(package
- (inherit coreutils)
- (version \"42\"))")
-
-(test-pretty-print "\
-(modify-phases %standard-phases
- (add-after 'unpack 'post-unpack
- (lambda _
- #t))
- (add-before 'check 'pre-check
- (lambda* (#:key inputs #:allow-other-keys)
- do things ...)))")
-
-(test-pretty-print "\
-(#:phases (modify-phases sdfsdf
- (add-before 'x 'y
- (lambda _
- xyz))))")
-
-(test-pretty-print "\
-(description \"abcdefghijkl
-mnopqrstuvwxyz.\")"
- #:max-width 30)
-
-(test-pretty-print "\
-(description
- \"abcdefghijkl
-mnopqrstuvwxyz.\")"
- #:max-width 12)
-
-(test-pretty-print "\
-(description
- \"abcdefghijklmnopqrstuvwxyz\")"
- #:max-width 33)
-
-(test-pretty-print "\
-(modify-phases %standard-phases
- (replace 'build
- ;; Nicely indented in 'modify-phases' context.
- (lambda _
- #t)))")
-
-(test-pretty-print "\
-(modify-inputs inputs
- ;; Regular indentation for 'replace' here.
- (replace \"gmp\" gmp))")
(test-end)