aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-07-08 14:33:49 +0200
committerGitHub <noreply@github.com>2021-07-08 14:33:49 +0200
commit8648143120c60c9e104e5b2fd3beee2cfd2268d2 (patch)
tree5f33c56bf64878483349ce10856cfb04468b57ae /tests
parent2172e60f7a53a56ff1ce04f3b683fb618fc5d3f7 (diff)
parent7e5c79a2d210e7b986803d5fe5c7ebb504b3e74e (diff)
Merge pull request #4988 from NixOS/fetchgit-name-attribute
Add a name attribute to the fetchers
Diffstat (limited to 'tests')
-rw-r--r--tests/fetchGit.sh4
-rw-r--r--tests/fetchMercurial.sh5
-rw-r--r--tests/tarball.sh5
3 files changed, 14 insertions, 0 deletions
diff --git a/tests/fetchGit.sh b/tests/fetchGit.sh
index 88744ee7f..89294d8d2 100644
--- a/tests/fetchGit.sh
+++ b/tests/fetchGit.sh
@@ -189,3 +189,7 @@ path8=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = \"file://$rep
rev4=$(git -C $repo rev-parse HEAD)
rev4_nix=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = \"file://$repo\"; ref = \"HEAD\"; }).rev")
[[ $rev4 = $rev4_nix ]]
+
+# The name argument should be handled
+path9=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = \"file://$repo\"; ref = \"HEAD\"; name = \"foo\"; }).outPath")
+[[ $path9 =~ -foo$ ]]
diff --git a/tests/fetchMercurial.sh b/tests/fetchMercurial.sh
index d8a4e09d2..726840664 100644
--- a/tests/fetchMercurial.sh
+++ b/tests/fetchMercurial.sh
@@ -94,3 +94,8 @@ hg commit --cwd $repo -m 'Bla3'
path4=$(nix eval --impure --refresh --raw --expr "(builtins.fetchMercurial file://$repo).outPath")
[[ $path2 = $path4 ]]
+
+echo paris > $repo/hello
+# Passing a `name` argument should be reflected in the output path
+path5=$(nix eval -vvvvv --impure --refresh --raw --expr "(builtins.fetchMercurial { url = \"file://$repo\"; name = \"foo\"; } ).outPath")
+[[ $path5 =~ -foo$ ]]
diff --git a/tests/tarball.sh b/tests/tarball.sh
index d53ec8cd9..1301922a5 100644
--- a/tests/tarball.sh
+++ b/tests/tarball.sh
@@ -40,6 +40,11 @@ test_tarball() {
(! nix-instantiate --eval -E '<fnord/xyzzy> 1' -I fnord=file://no-such-tarball$ext)
nix-instantiate --eval -E '<fnord/config.nix>' -I fnord=file://no-such-tarball$ext -I fnord=.
+
+ # Ensure that the `name` attribute isn’t accepted as that would mess
+ # with the content-addressing
+ (! nix-instantiate --eval -E "fetchTree { type = \"tarball\"; url = file://$tarball; narHash = \"$hash\"; name = \"foo\"; }")
+
}
test_tarball '' cat