use local::lib ();
+my $prev_active = () = local::lib->active_paths;
+
local::lib->import($dir1);
-is +() = local::lib->active_paths, 1, 'one active path';
+is +() = local::lib->active_paths, $prev_active + 1, 'one active path';
like $ENV{PERL_LOCAL_LIB_ROOT}, qr/\Q$dir1/, 'added one dir in root';
like $ENV{PERL5LIB}, qr/\Q$dir1/, 'added one dir in lib';
like $ENV{PERL_MM_OPT}, qr/\Q$dir1/, 'first path is installation target';
local::lib->import($dir1);
-is +() = local::lib->active_paths, 1, 'still one active path after adding it twice';
+is +() = local::lib->active_paths, $prev_active + 1, 'still one active path after adding it twice';
local::lib->import($dir2);
-is +() = local::lib->active_paths, 2, 'two active paths';
+is +() = local::lib->active_paths, $prev_active + 2, 'two active paths';
like $ENV{PERL_LOCAL_LIB_ROOT}, qr/\Q$dir2/, 'added another dir in root';
like $ENV{PERL5LIB}, qr/\Q$dir2/, 'added another dir in lib';
like $ENV{PERL_LOCAL_LIB_ROOT}, qr/\Q$dir1/, 'first dir is still in root';
local::lib->import($dir1);
my @active = local::lib->active_paths;
-is @active, 2, 'still two active dirs after re-adding first';
+is @active, $prev_active + 2, 'still two active dirs after re-adding first';
is $active[-1], $dir1, 'first dir was re-added on top';
like $ENV{PERL_MM_OPT}, qr/\Q$dir1/, 'first path is installation target again';