summaryrefslogtreecommitdiff
path: root/t/11_utils.t
blob: 6602cb8191abf329bf7fd9646d610d86f9bb81fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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;