diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-02-02 00:03:07 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-02-02 00:03:12 -0700 |
commit | 6e1ae015b4d6a55512be3f16f9a3eaaef343f09f (patch) | |
tree | 01b563f5f5481cc8aa5cda246dab78dcd113d03c /t | |
parent | 9ec5bbf4d5622b67ce069c0006e5b3979e86c19e (diff) | |
download | p5-Git-Annex-6e1ae015b4d6a55512be3f16f9a3eaaef343f09f.tar.gz |
add abs_contentlocation
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 't')
-rwxr-xr-x | t/11_utils.t | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/t/11_utils.t b/t/11_utils.t index d7343bc..4427da9 100755 --- a/t/11_utils.t +++ b/t/11_utils.t @@ -5,16 +5,20 @@ use strict; use warnings; use lib 't/lib'; +use Cwd qw(realpath); use Test::More; use Git::Annex; -use File::Spec::Functions qw(catfile); +use File::Spec::Functions qw(catfile rel2abs); use t::Setup; use Storable; use Data::Compare; +use File::chdir; +use File::Basename qw(basename); 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", "foo") eq catfile($temp, qw(source1 .git blah foo)), @@ -28,6 +32,16 @@ with_temp_annexes { $annex->_clear_unused_cache; ok !exists $annex->{_unused}, "_clear_unused_cache clears unused hashref"; ok !-f $unused_info, "_clear_unused_cache deletes the cache"; + + { + local $CWD = catfile qw(source1 foo foo2); + my $contentlocation = realpath rel2abs readlink "baz"; + my $key = basename readlink "baz"; + is $annex->abs_contentlocation($key), $contentlocation, + "it returns an absolute path to the content for foo/foo2/baz"; + is $annex->abs_contentlocation("foo"), undef, + "it returns undef for a nonsense key"; + } }; done_testing; |