diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-02-01 12:07:44 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-02-01 12:07:44 -0700 |
commit | 7c6d991939009024e233d345d3e165017ff17e41 (patch) | |
tree | 774b15cc8df482e5adf409ee273496580a614540 /t | |
parent | 8a8a668b3ad3c47a0e761b9fa6dab580e7dba32e (diff) | |
download | p5-Git-Annex-7c6d991939009024e233d345d3e165017ff17e41.tar.gz |
add .git dir utils
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 't')
-rwxr-xr-x | t/11_utils.t | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/t/11_utils.t b/t/11_utils.t new file mode 100755 index 0000000..6602cb8 --- /dev/null +++ b/t/11_utils.t @@ -0,0 +1,29 @@ +#!/usr/bin/perl + +use 5.028; +use strict; +use warnings; +use lib 't/lib'; + +use Test::More; +use Git::Annex; +use File::Spec::Functions qw(catfile); +use t::Setup; +use File::Slurp; + +with_temp_annexes { + my $temp = shift; + my $annex = Git::Annex->new("source1"); + my $unused_info = catfile($temp, qw(source1 .git annex unused_info)); + ok $annex->_git_path("blah") eq catfile($temp, qw(source1 .git blah)), + "_git_path resolves a path"; + ok $annex->_unused_cache eq $unused_info, + "_unused_cache resolves to correct path"; + $annex->{_unused} = { foo => "bar" }; + write_file $unused_info, "baz\n"; + $annex->_clear_unused_cache; + ok !exists $annex->{_unused}, "_clear_unused_cache clears unused hashref"; + ok !-f $unused_info, "_clear_unused_cache deletes the cache"; +}; + +done_testing; |