summaryrefslogtreecommitdiff
path: root/tests/guix-hash.sh
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-05-11 15:09:56 +0200
committerLudovic Courtès <ludo@gnu.org>2013-05-11 15:09:56 +0200
commitccbce84809db80e6d9bc42e96f9edb2071152b56 (patch)
tree6736eb07bd6377e4243c37de27f7b6cf981507ad /tests/guix-hash.sh
parent438bb042ff31619f43960113e7cd9e1b2818ff1c (diff)
downloadpatches-ccbce84809db80e6d9bc42e96f9edb2071152b56.tar
patches-ccbce84809db80e6d9bc42e96f9edb2071152b56.tar.gz
tests: Add `guix hash' test.
* guix/scripts/hash.scm (guix-hash)[eof->null]: New procedure. Use it to convert the EOF object to the empty bytevector. * tests/guix-hash.sh: New file. * Makefile.am (SH_TESTS): Add it.
Diffstat (limited to 'tests/guix-hash.sh')
-rw-r--r--tests/guix-hash.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/guix-hash.sh b/tests/guix-hash.sh
new file mode 100644
index 0000000000..53325ce1f4
--- /dev/null
+++ b/tests/guix-hash.sh
@@ -0,0 +1,28 @@
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+#
+# 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 hash' command-line utility.
+#
+
+guix hash --version
+
+test `guix hash /dev/null` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73
+test `guix hash -f nix-base32 /dev/null` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73
+test `guix hash -f hex /dev/null` = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
+test `guix hash -f base32 /dev/null` = 4oymiquy7qobjgx36tejs35zeqt24qpemsnzgtfeswmrw6csxbkq