diff options
author | Branislav ZahradnĂk <happybarney@gmail.com> | 2018-10-14 09:30:59 +0200 |
---|---|---|
committer | Branislav ZahradnĂk <happybarney@gmail.com> | 2018-10-20 18:40:57 +0200 |
commit | 7446c947ce656f895a85ba08313177d784dd3933 (patch) | |
tree | 7e5d0d739503d50e700dad6202fd9fdc2041e6a8 /t | |
parent | 11a018209ee22f5937f0dedfdf990a87acf19ef7 (diff) |
Replace path_with_tilde() with internal Path class method
Diffstat (limited to 't')
-rw-r--r-- | t/03.path_with_tilde.t | 14 | ||||
-rw-r--r-- | t/app-perlbrew-path.t | 16 |
2 files changed, 16 insertions, 14 deletions
diff --git a/t/03.path_with_tilde.t b/t/03.path_with_tilde.t deleted file mode 100644 index a8bb516..0000000 --- a/t/03.path_with_tilde.t +++ /dev/null @@ -1,14 +0,0 @@ -#!perl -use strict; -use Test::More tests => 2; -use App::perlbrew; - -my $app = App::perlbrew->new(); -my $home = $app->env("HOME"); - -SKIP: { - skip "This test is meanless when \$HOME-less.", 2 unless $home; - - is $app->path_with_tilde("$home/foo/bar"), "~/foo/bar"; - is $app->path_with_tilde("/baz/foo/bar"), "/baz/foo/bar"; -} diff --git a/t/app-perlbrew-path.t b/t/app-perlbrew-path.t index 87eebd3..0527592 100644 --- a/t/app-perlbrew-path.t +++ b/t/app-perlbrew-path.t @@ -183,6 +183,22 @@ describe "App::Perlbrew::Path" => sub { }; }; + describe "stringify_with_tilde" => sub { + it "should expand leading homedir" => sub { + local $ENV{HOME} = "/home/perlbrew"; + my $path = App::Perlbrew::Path->new ("/home/perlbrew/.root"); + + is $path->stringify_with_tilde, "~/.root"; + }; + + it "should not expand leading homedir prefix" => sub { + local $ENV{HOME} = "/home/perlbrew"; + my $path = App::Perlbrew::Path->new ("/home/perlbrew-stable/.root"); + + is $path->stringify_with_tilde, "/home/perlbrew-stable/.root"; + }; + }; + describe "symlink()" => sub { it "should create symlink" => sub { my $root = arrange_testdir; |