gnu: Add go-github-com-itchyny-gojq.
[jackhill/guix/guix.git] / tests / print.scm
CommitLineData
68a91a18 1;;; GNU Guix --- Functional package management for GNU
10af34cd 2;;; Copyright © 2017, 2020 Ricardo Wurmus <rekado@elephly.net>
68a91a18
RW
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (test-print)
20 #:use-module (guix import print)
21 #:use-module (guix build-system gnu)
22 #:use-module (guix download)
23 #:use-module (guix packages)
10af34cd 24 #:use-module ((guix licenses) #:prefix license:)
b2ed40c2 25 #:use-module ((gnu packages) #:select (search-patches))
68a91a18
RW
26 #:use-module (srfi srfi-64))
27
c0a4db66
LC
28(define-syntax-rule (define-with-source object source expr)
29 (begin
30 (define object expr)
31 (define source 'expr)))
32
68a91a18
RW
33(test-begin "print")
34
c0a4db66
LC
35(define-with-source pkg pkg-source
36 (package
37 (name "test")
38 (version "1.2.3")
39 (source (origin
40 (method url-fetch)
41 (uri (string-append "file:///tmp/test-"
42 version ".tar.gz"))
43 (sha256
44 (base32
45 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
10af34cd 46 (build-system (@ (guix build-system gnu) gnu-build-system))
c0a4db66
LC
47 (home-page "http://gnu.org")
48 (synopsis "Dummy")
49 (description "This is a dummy package.")
10af34cd 50 (license license:gpl3+)))
c0a4db66
LC
51
52(define-with-source pkg-with-inputs pkg-with-inputs-source
68a91a18
RW
53 (package
54 (name "test")
55 (version "1.2.3")
56 (source (origin
57 (method url-fetch)
58 (uri (string-append "file:///tmp/test-"
59 version ".tar.gz"))
60 (sha256
61 (base32
62 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
10af34cd 63 (build-system (@ (guix build-system gnu) gnu-build-system))
ff992fcf
LC
64 (inputs (list (@ (gnu packages base) coreutils)
65 `(,(@ (gnu packages base) glibc) "debug")))
68a91a18
RW
66 (home-page "http://gnu.org")
67 (synopsis "Dummy")
68 (description "This is a dummy package.")
10af34cd 69 (license license:gpl3+)))
68a91a18 70
04d92957
LC
71(define-with-source pkg-with-origin-input pkg-with-origin-input-source
72 (package
73 (name "test")
74 (version "1.2.3")
75 (source (origin
76 (method url-fetch)
b3240ae8
LC
77 (uri (list (string-append "file:///tmp/test-"
78 version ".tar.gz")
79 (string-append "http://example.org/test-"
80 version ".tar.gz")))
04d92957
LC
81 (sha256
82 (base32
b2ed40c2
LC
83 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))
84 (patches (search-patches "guile-linux-syscalls.patch"
85 "guile-relocatable.patch"))))
04d92957
LC
86 (build-system (@ (guix build-system gnu) gnu-build-system))
87 (inputs
88 `(("o" ,(origin
89 (method url-fetch)
90 (uri "http://example.org/somefile.txt")
91 (sha256
92 (base32
93 "0000000000000000000000000000000000000000000000000000"))))))
94 (home-page "http://gnu.org")
95 (synopsis "Dummy")
96 (description "This is a dummy package.")
97 (license license:gpl3+)))
98
b2ed40c2
LC
99(define-with-source pkg-with-origin-patch pkg-with-origin-patch-source
100 (package
101 (name "test")
102 (version "1.2.3")
103 (source (origin
104 (method url-fetch)
105 (uri (string-append "file:///tmp/test-"
106 version ".tar.gz"))
107 (sha256
108 (base32
109 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))
110 (patches
111 (list (origin
112 (method url-fetch)
113 (uri "http://example.org/x.patch")
114 (sha256
115 (base32
116 "0000000000000000000000000000000000000000000000000000")))))))
117 (build-system (@ (guix build-system gnu) gnu-build-system))
118 (home-page "http://gnu.org")
119 (synopsis "Dummy")
120 (description "This is a dummy package.")
121 (license license:gpl3+)))
122
3756ce32
LC
123(define-with-source pkg-with-arguments pkg-with-arguments-source
124 (package
125 (name "test")
126 (version "1.2.3")
127 (source (origin
128 (method url-fetch)
129 (uri (string-append "file:///tmp/test-"
130 version ".tar.gz"))
131 (sha256
132 (base32
133 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
134 (build-system (@ (guix build-system gnu) gnu-build-system))
135 (arguments
136 `(#:disallowed-references (,(@ (gnu packages base) coreutils))))
137 (home-page "http://gnu.org")
138 (synopsis "Dummy")
139 (description "This is a dummy package.")
140 (license license:gpl3+)))
141
8b2119a5 142(define-with-source pkg-with-properties pkg-with-properties-source
143 (package
144 (name "test")
145 (version "1.2.3")
146 (source (origin
147 (method url-fetch)
148 (uri (string-append "file:///tmp/test-"
149 version ".tar.gz"))
150 (sha256
151 (base32
152 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
153 (properties
154 `((hidden? . #t) (upstream-name "test-upstream")))
155 (build-system (@ (guix build-system gnu) gnu-build-system))
156 (home-page "http://gnu.org")
157 (synopsis "Dummy")
158 (description "This is a dummy package.")
159 (license license:gpl3+)))
160
68a91a18 161(test-equal "simple package"
10af34cd 162 `(define-public test ,pkg-source)
c0a4db66
LC
163 (package->code pkg))
164
165(test-equal "package with inputs"
10af34cd 166 `(define-public test ,pkg-with-inputs-source)
c0a4db66 167 (package->code pkg-with-inputs))
68a91a18 168
04d92957
LC
169(test-equal "package with origin input"
170 `(define-public test ,pkg-with-origin-input-source)
171 (package->code pkg-with-origin-input))
172
b2ed40c2
LC
173(test-equal "package with origin patch"
174 `(define-public test ,pkg-with-origin-patch-source)
175 (package->code pkg-with-origin-patch))
176
3756ce32
LC
177(test-equal "package with arguments"
178 `(define-public test ,pkg-with-arguments-source)
179 (package->code pkg-with-arguments))
180
8b2119a5 181(test-equal "package with properties"
182 `(define-public test ,pkg-with-properties-source)
183 (package->code pkg-with-properties))
184
68a91a18 185(test-end "print")