diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-07-08 14:33:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 14:33:49 +0200 |
commit | 8648143120c60c9e104e5b2fd3beee2cfd2268d2 (patch) | |
tree | 5f33c56bf64878483349ce10856cfb04468b57ae /tests | |
parent | 2172e60f7a53a56ff1ce04f3b683fb618fc5d3f7 (diff) | |
parent | 7e5c79a2d210e7b986803d5fe5c7ebb504b3e74e (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.sh | 4 | ||||
-rw-r--r-- | tests/fetchMercurial.sh | 5 | ||||
-rw-r--r-- | tests/tarball.sh | 5 |
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 |