File: builddir.t

package info (click to toggle)
perlbrew 1.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 752 kB
  • sloc: perl: 9,387; makefile: 7; sh: 1
file content (43 lines) | stat: -rw-r--r-- 1,192 bytes parent folder | download | duplicates (2)
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
40
41
42
43
#!/usr/bin/env perl
use Test2::V0;
use Test2::Tools::Spec;

use FindBin;
use lib $FindBin::Bin;
use App::perlbrew;
require "test2_helpers.pl";

sub looks_like_perlbrew_builddir;

describe "App::perlbrew#builddir method" => sub {
    it "should return path in \$App::perlbrew::PERLBREW_ROOT normally" => sub {
        local $App::perlbrew::PERLBREW_ROOT = '/perlbrew/root';
        my $app = App::perlbrew->new;

        looks_like_perlbrew_builddir $app->builddir, '/perlbrew/root/build';
    };

    it "should return path relative to root" => sub {
        my $app = App::perlbrew->new;
        $app->root("/fnord");

        looks_like_perlbrew_builddir $app->builddir, "/fnord/build";
    };
};

describe "App::perlbrew->new" => sub {
    it "should accept --builddir args" => sub {
        local $App::perlbrew::PERLBREW_ROOT = '/perlbrew/root';
        my $app = App::perlbrew->new("--builddir" => "/perlbrew/buildroot");

        looks_like_perlbrew_builddir $app->builddir, "/perlbrew/buildroot";
    };
};

done_testing;

sub looks_like_perlbrew_builddir {
    my ($got, $expected) = @_;
    is "$got", "$expected", "builddir is $expected";
    isa_ok $got, 'App::Perlbrew::Path';
}