1
1
mirror of https://github.com/nmattia/niv.git synced 2024-09-05 20:15:26 +03:00

Add dummy git test

This commit is contained in:
Nicolas Mattia 2019-11-30 11:55:35 +01:00
parent 0a8b4f0ffd
commit 507d759e9c
2 changed files with 32 additions and 0 deletions

View File

@ -191,6 +191,7 @@ rec
inherit niv niv-sdist niv-source niv-devshell niv-cabal-upload;
tests-github = pkgs.callPackage ./tests/github { inherit niv; };
tests-git = pkgs.callPackage ./tests/git { inherit niv; };
niv-test = pkgs.runCommand "niv-test" { buildInputs = [ niv ]; }
"niv-test && touch $out";

31
tests/git/default.nix Normal file
View File

@ -0,0 +1,31 @@
{ pkgs, niv }:
# TODO: this doesn' test anything meaningful yet because "niv git PACKAGE"
# doesn't parse yet
pkgs.runCommand "foo"
{ nativeBuildInputs = [ pkgs.git niv ]; }
''
gitdir=$(mktemp -d)
pushd $gitdir
git init .
echo hello > file
git config user.email "niv@foo.bar"
git config user.name "Niv Niverson"
git add file
git commit -m "Initial commit"
gitrev=$(git rev-parse HEAD)
popd
nivdir=$(mktemp -d)
pushd $nivdir
mkdir -p nix
echo "{}" > nix/sources.json
niv init
# niv add git -n my-git-repo file://$gitdir
# nix eval --json '(import ./nix/sources.nix).my-git-repo.rev'
popd
touch $out
''