diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-02-01 10:52:36 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-02-01 10:53:07 -0700 |
commit | 067680560397147080a8eba480abd9637e6e0251 (patch) | |
tree | 01ce21eefce8850faa49fb60df9cf28aa1819cea /t/10_init.t | |
parent | a99a0e9e9f8cf83e7e1e41a4b4ac49a32ca76ee4 (diff) | |
download | p5-Git-Annex-067680560397147080a8eba480abd9637e6e0251.tar.gz |
factor out with_temp_annex
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 't/10_init.t')
-rwxr-xr-x | t/10_init.t | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/t/10_init.t b/t/10_init.t index 02e284c..0d4b5a8 100755 --- a/t/10_init.t +++ b/t/10_init.t @@ -3,12 +3,13 @@ use 5.028; use strict; use warnings; +use lib 't/lib'; use Test::More; use Git::Annex; use File::chdir; -use File::Slurp; use File::Temp qw(tempdir); +use t::Setup; { my $temp = tempdir CLEANUP => 1; @@ -30,26 +31,13 @@ use File::Temp qw(tempdir); # lazy init of Git::Repository object requires an actual git repo, not # just an empty tempdir -with_temp_annex(sub { +with_temp_annex { my $temp = shift; my $annex = Git::Annex->new($temp); ok !defined $annex->{repo}, "Git::Repository instance lazily instantiated"; ok $annex->repo->isa("Git::Repository") && defined $annex->{repo}, "Git::Repository instance available"; ok $annex->repo->work_tree eq $temp, "Git::Repository has correct toplevel"; -}); - -sub with_temp_annex { - my $temp = tempdir CLEANUP => 1; - { - local $CWD = $temp; - system qw(git init); - system qw(git annex init); - write_file "foo", "my cool big file\n"; - system qw(git annex add foo); - system qw(git commit -madd); - } - &{$_[0]}($temp); -} +}; done_testing; |