aboutsummaryrefslogtreecommitdiff
# 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)"
onts, fpga, game-development, games, gl, gnome, gnuzilla, graphics, guile, haskell, image, java, kodi, ldc, libreoffice, markup, maths, mc, monitoring, music, php, pretty-print, python, scheme, smalltalk, statistics, synergy, tex, textutils, video, web-browsers, xml, zip}.scm, guix/build-system/{ant, font}.scm, guix/{download, packages}.scm: Adapt module import. Arun Isaac 2016-12-05nls: Adjust to geeqie.scm removal....This is a followup to d1a5b20081c30da7503201df260cf20b8d0ba633. * po/packages/POTFILES.in: Remove gnu/packages/geeqie.scm. Ludovic Courtès 2016-12-04nls: Adjust to feh.scm renaming....This is a followup to d1a5b20081c30da7503201df260cf20b8d0ba633. * po/packages/POTFILES.in: Remove feh.scm and add image-viewers.scm. Ludovic Courtès 2016-08-04nls: Adjust to zsh.scm renaming....* po/packages/POTFILES.in: Adjust to zsh.scm renaming in commit 7ccb874a299d6c6d86a3f1625a68c08ed20dbab6. Ludovic Courtès 2016-05-26nls: Adjust to texlive.scm renaming....* po/packages/POTFILES.in: Adjust to texlive.scm rename in commit 8f9ac90182c022c69600f17ef9c1149e029bc301. Ludovic Courtès 2016-03-03po: Drop removed file 'weechat.scm'....Fixes <http://bugs.gnu.org/22888>. weechat has been merged into 'irc.scm' in e288f007. * po/packages/POTFILES.in: Drop removed file 'weechat.scm'. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Justus Winter 2015-07-19nls: Add package files for translation....* po/packages/POTFILES.in: Add a bunch of files. Ludovic Courtès 2015-05-10nls: Add package files for translation....* po/packages/POTFILES.in: Add a bunch of files. Ludovic Courtès 2015-01-27nls: Add a few more package modules for translation....* po/packages/POTFILES.in: List a few more files. Ludovic Courtès 2014-11-10nls: Add a few more package modules for translation....* po/packages/POTFILES.in: List a few more files. Ludovic Courtès 2014-09-11nls: Adjust reference to stale file....* po/packages/POTFILES.in: Replace recutils.scm with databases.scm. Ludovic Courtès 2014-06-13Separate package description translations from string translations....* po/packages/LINGUAS, po/packages/Makevars, po/packages/POTFILES.in: New files. * po/guix/Makevars (DOMAIN): Change to "guix". (XGETTEXT_OPTIONS): Remove "--keyword=synopsis --keyword=description". * po/guix/POTFILES.in: Remove gnu/packages/*.scm. * configure.ac: Change to gettext 0.18.3. Produce po/packages/Makefile.in. * Makefile.am (SUBDIRS): Add po/packages. * guix/ui.scm (%package-text-domain): New variable. (P_): New procedure. (package->recutils): Use 'P_' instead of '_'. * guix/scripts/package.scm (find-packages-by-description): Use 'P_' instead of 'gettext'. Ludovic Courtès