File: 12-create.t

package info (click to toggle)
libgit-repository-perl 1.325-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 376 kB
  • sloc: perl: 661; makefile: 7
file content (39 lines) | stat: -rw-r--r-- 819 bytes parent folder | download | duplicates (4)
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
30
31
32
33
34
35
36
37
38
39
use strict;
use warnings;
use Test::More;
use Test::Requires::Git;
use Test::Git;
use File::Temp qw( tempdir );
use File::Spec;
use File::Path;
use Cwd qw( cwd realpath );
use Git::Repository;

test_requires_git '1.5.0.rc0';

my $version = Git::Repository->version;

plan tests => my $tests;

# clean up the environment
delete @ENV{qw( GIT_DIR GIT_WORK_TREE )};
$ENV{LC_ALL} = 'C';
my $home = cwd();

# a place to put a git repository
my $dir = realpath( tempdir( CLEANUP => 1 ) );

BEGIN { $tests += 2 }
mkpath $dir;
chdir $dir;

# check that create() dies
my $r = eval { Git::Repository->create('init'); };
ok( !$r, "Git::Repository->create() fails " );
like(
    $@,
    qr/^create\(\) is deprecated, see Git::Repository::Tutorial for better alternatives at /,
    "... with expected error message"
);
chdir $home;