1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
3 # Copyright © 2020 Konrad Hinsen <konrad.hinsen@fastmail.net>
5 # This file is part of GNU Guix.
7 # GNU Guix is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or (at
10 # your option) any later version.
12 # GNU Guix is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 # Test the `guix repl' command-line utility.
26 test_directory
="`mktemp -d`"
28 trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT
30 tmpfile
="$test_directory/foo.scm"
32 trap 'rm -f "$tmpfile"' EXIT
34 module_dir
="t-guix-repl-$$"
36 trap 'rm -rf "$module_dir"' EXIT
40 (use-modules (guix packages)
43 (format #t "~a\n" (package-name coreutils))
46 test "`guix repl "$tmpfile"`" = "coreutils"
49 cat > "$module_dir/foo.scm"<<EOF
51 #:use-module (guix packages)
52 #:use-module (gnu packages base))
55 (package (inherit hello)
58 (synopsis "dummy package")
59 (description "dummy package. Only used for testing purposes.")))
63 (use-modules (guix packages)
66 (format #t "~a\n" (package-version dummy))
69 test "`guix repl "$tmpfile" -L "$module_dir"`" = "42"
72 (format #t "~a\n" (cdr (command-line)))
75 test "`guix repl -- "$tmpfile" -a b --input=foo.txt`" = "(-a b --input=foo.txt)"
78 #!$(type -P env) -S guix repl --
80 (format #t "~a\n" (cdr (command-line)))
84 test "`"$tmpfile" -a b --input=foo.txt`" = "(-a b --input=foo.txt)"