aboutsummaryrefslogtreecommitdiff
path: root/tests/guix-repl.sh
blob: d4ebb5f6c68d7cbce427eb46c10dd0da40c2c582 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# GNU Guix --- Functional package management for GNU
# Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
# Copyright © 2020 Konrad Hinsen <konrad.hinsen@fastmail.net>
#
# This file is part of GNU Guix.
#
# GNU Guix is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Guix is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

#
# Test the `guix repl' command-line utility.
#

guix repl --version

test_directory="`mktemp -d`"
export test_directory
trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT

tmpfile="$test_directory/foo.scm"
rm -f "$tmpfile"
trap 'rm -f "$tmpfile"' EXIT

module_dir="t-guix-repl-$$"
mkdir "$module_dir"
trap 'rm -rf "$module_dir"' EXIT


cat > "$tmpfile"<<EOF
(use-modules (guix packages)
             (gnu packages base))

(format #t "~a\n" (package-name coreutils))
EOF

test "`guix repl "$tmpfile"`" = "coreutils"

# Make sure that the file can also be loaded when passed as a relative file
# name.
(cd "$(dirname "$tmpfile")"; test "$(guix repl "$(basename "$tmpfile")")" = "coreutils")


cat > "$module_dir/foo.scm"<<EOF
(define-module (foo)
  #:use-module (guix packages)
  #:use-module (gnu packages base))

(define-public dummy
  (package (inherit hello)
    (name "dummy")
    (version "42")
    (synopsis "dummy package")
    (description "dummy package. Only used for testing purposes.")))
EOF

cat > "$tmpfile"<<EOF
(use-modules (guix packages)
             (foo))

(format #t "~a\n" (package-version dummy))
EOF

test "`guix repl "$tmpfile" -L "$module_dir"`" = "42"

cat > "$tmpfile"<<EOF
(format #t "~a\n" (cdr (command-line)))
EOF

test "`guix repl -- "$tmpfile" -a b --input=foo.txt`" = "(-a b --input=foo.txt)"

cat > "$tmpfile"<<EOF
#!$(type -P env) -S guix repl --
!#
(format #t "~a\n" (cdr (command-line)))
EOF
chmod 755 $tmpfile

test "`"$tmpfile" -a b --input=foo.txt`" = "(-a b --input=foo.txt)"
d Troy Figiel 2024-06-28gnu: go-github-com-masterminds-sprig: Rename variable....* gnu/packages/golang-xyz.scm (go-github-com-masterminds-sprig): Rename to go-github-com-masterminds-sprig-v3. [arguments]: <#:import-path>: Reflect import path as seen in go.mod. * gnu/packages/configuration-management.scm (chezmoi) [native-inputs]: Replace go-github-com-masterminds-sprig with go-github-com-masterminds-sprig-v3. Change-Id: I2d171ff9f719e6664266723ae0483f73cef343c5 Sharlatan Hellseher 2024-06-28gnu: chezmoi: Refresh package style....* gnu/packages/configuration-management.scm (chezmoi): Use G-expressions and list style, re-indent. [arguments]: <#:go>: Set to go-1.21. Change-Id: I5a7a4deffcd8b9102614b3f628a7ddd33ee82633 Sharlatan Hellseher 2024-06-28gnu: chezmoi: Remove propagated inputs....* gnu/packages/configuration-management.scm (chezmoi): Remove propagated inputs. [native-inputs]: Remove go-github-com-google-uuid, go-github-com-huandu-xstrings, go-github-com-imdario-mergo, go-github-com-masterminds-goutils, go-github-com-masterminds-semver, go-github-com-mitchellh-copystructure, go-github-com-mitchellh-reflectwalk, and go-golang-org-x-crypto. Change-Id: Ifeb42652b07827e76c57a0165683200af312faf3 Sharlatan Hellseher 2024-02-19gnu: chezmoi: Update to 1.8.10....* gnu/packages/configuration-management.scm (chezmoi): Update to 1.8.10. [arguments] <#:phases>: Add 'remove-failing-test-scripts phase, deleting testdata scripts requiring additional programs. [native-inputs]: Remove go-github-com-bmatcuk-doublestar and go-github-com-google-go-github; add go-github-com-bmatcuk-doublestar-v2, go-github-com-google-go-github-v33, and go-golang-org-x-term. Change-Id: Ia0b9b7e4dd00e99bc8150816c46b456cc272b25c Sharlatan Hellseher 2024-02-19gnu: chezmoi: Sort inputs alphabetically....* gnu/packages/configuration-management.scm (chezmoi) [native-inputs]: Sort alphabetically to ease maintenance. Change-Id: I22b82ce7163db696c4d9e8484fbe72da086a4139 Sharlatan Hellseher 2024-02-19gnu: go-github-com-alecthomas-chroma: Move to golang-xyz....* gnu/packages/golang.scm (go-github-com-alecthomas-chroma): Move from here ... * gnu/packages/golang-xyz.scm: ... to here. * gnu/packages/configuration-management.scm: Add (gnu packages golang-xyz) module. Change-Id: I0f5f7068f530b282f3636678e9edc4fad6c8c94a Sharlatan Hellseher 2024-02-13gnu: go-golang-org-x-net: Move to golang-build....* gnu/packages/golang.scm (go-golang-org-x-net, go-golang-org-x-net-0.17, go-golang-org-x-net-html): Move from here ... * gnu/packages/golang-build.scm: ... to here. * gnu/packages/configuration-management.scm: Add (gnu packages golang-build) module. * gnu/packages/education.scm: As above ... * gnu/packages/file-systems.scm: As above ... * gnu/packages/golang-check.scm: As above ... * gnu/packages/golang-crypto.scm: As above ... * gnu/packages/golang-web.scm: As above ... * gnu/packages/golang-xyz.scm: As above ... * gnu/packages/golang.scm: As above ... * gnu/packages/ipfs.scm: As above ... * gnu/packages/messaging.scm: As above ... * gnu/packages/networking.scm: As above ... * gnu/packages/uucp.scm: As above ... * gnu/packages/version-control.scm: As above ... Change-Id: If009e62555ada293f17cf0f42fde82c21ef4615e Sharlatan Hellseher 2024-01-03gnu: go-github-com-gorilla-css: Move to (gnu packages golang-web)....* gnu/packages/golang.scm (go-github-com-gorilla-css): Move from here... * gnu/packages/golang-web.scm: ...to here. * gnu/packages/configuration-management.sc: Add (gnu packages golang-web) module. * gnu/packages/golang.scm: As above... Change-Id: I6e387966d05c40321b9116b93d76fce68aad8c7f Sharlatan Hellseher