aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/local.mk3
-rw-r--r--tests/path-from-hash-part.sh10
2 files changed, 12 insertions, 1 deletions
diff --git a/tests/local.mk b/tests/local.mk
index 5e48ceae1..340817ec3 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -109,7 +109,8 @@ nix_tests = \
store-ping.sh \
fetchClosure.sh \
completions.sh \
- impure-derivations.sh
+ impure-derivations.sh \
+ path-from-hash-part.sh
ifeq ($(HAVE_LIBCPUID), 1)
nix_tests += compute-levels.sh
diff --git a/tests/path-from-hash-part.sh b/tests/path-from-hash-part.sh
new file mode 100644
index 000000000..bdd104434
--- /dev/null
+++ b/tests/path-from-hash-part.sh
@@ -0,0 +1,10 @@
+source common.sh
+
+path=$(nix build --no-link --print-out-paths -f simple.nix)
+
+hash_part=$(basename $path)
+hash_part=${hash_part:0:32}
+
+path2=$(nix store path-from-hash-part $hash_part)
+
+[[ $path = $path2 ]]