Had a couple of mistakes in the patch. This one is more effective.
diff -urN Filesys-Virtual-Chroot-1.4/t/02vchdir.t Filesys-Virtual-Chroot-1.4-new/t/02vchdir.t
--- Filesys-Virtual-Chroot-1.4/t/02vchdir.t 2015-11-14 16:24:16.000000000 -0700
+++ Filesys-Virtual-Chroot-1.4-new/t/02vchdir.t 2015-11-16 15:46:31.385484802 -0700
@@ -1,27 +1,45 @@
use strict;
-use Test;
+use Cwd;
+use Test::More;
use File::Temp qw/ tempfile tempdir /;
+my $cwd = Cwd::cwd;
my $dir = tempdir();
-BEGIN { plan tests => 7 }
+BEGIN { plan tests => 9; }
use Filesys::Virtual::Chroot;
-my $cr;
-
-ok(eval {
- $cr = Filesys::Virtual::Chroot->new(
+my $cr = Filesys::Virtual::Chroot->new(
c => $dir,
- i => 0
- )
-});
+ i => 0,
+);
+
+is (ref $cr, 'Filesys::Virtual::Chroot', "object created ok");
+
+is ($@, '', "created the object ok");
my $time = time;
-ok($cr->rroot eq $dir);
-ok($cr->vpwd eq '/');
-ok(mkdir "$dir/vchroot.$time", 0755);
-ok($cr->vchdir("/vchroot.$time"));
-ok($cr->rpwd eq "$dir/vchroot.$time");
-ok(rmdir "$dir/vchroot.$time");
+if ($^O eq 'MSWin32'){
+ $dir =~ s|\\|/|g;
+}
+
+is ($cr->rroot, $dir, "rroot is same as \$dir");
+is ($cr->vpwd, '/', "vpwd is / dir");
+
+eval {
+ mkdir "$dir/vchroot.$time", 0755 or die $!;
+};
+
+is ($@, '', "\$time dir created ok");
+
+$cr->vchdir("/vchroot.$time");
+
+is ($cr->rpwd, "$dir/vchroot.$time", "changed into \$time dir ok");
+
+chdir $cwd;
+is (Cwd::cwd, $cwd, "changed into original dir location ok");
+
+is (system("rmdir", "\"$dir/vchroot.$time\""), 0, "temp time dir removed ok");
+is (system("rmdir", "\"$dir\""), 0, "test chroot dir removed ok");
diff -urN Filesys-Virtual-Chroot-1.4/t/02vchdir.t~ Filesys-Virtual-Chroot-1.4-new/t/02vchdir.t~
--- Filesys-Virtual-Chroot-1.4/t/02vchdir.t~ 1969-12-31 17:00:00.000000000 -0700
+++ Filesys-Virtual-Chroot-1.4-new/t/02vchdir.t~ 2015-11-16 15:46:00.570034062 -0700
@@ -0,0 +1,45 @@
+use strict;
+use Cwd;
+use Test::More;
+use File::Temp qw/ tempfile tempdir /;
+
+my $cwd = Cwd::cwd;
+my $dir = tempdir();
+
+BEGIN { plan tests => 8; }
+
+use Filesys::Virtual::Chroot;
+
+my $cr = Filesys::Virtual::Chroot->new(
+ c => $dir,
+ i => 0,
+);
+
+is (ref $cr, 'Filesys::Virtual::Chroot', "object created ok");
+
+is ($@, '', "created the object ok");
+
+my $time = time;
+
+if ($^O eq 'MSWin32'){
+ $dir =~ s|\\|/|g;
+}
+
+is ($cr->rroot, $dir, "rroot is same as \$dir");
+is ($cr->vpwd, '/', "vpwd is / dir");
+
+eval {
+ mkdir "$dir/vchroot.$time", 0755 or die $!;
+};
+
+is ($@, '', "\$time dir created ok");
+
+$cr->vchdir("/vchroot.$time");
+
+is ($cr->rpwd, "$dir/vchroot.$time", "changed into \$time dir ok");
+
+chdir $cwd;
+is (Cwd::cwd, $cwd, "changed into original dir location ok");
+
+is (system("rmdir", "\"$dir/vchroot.$time\""), 0, "temp time dir removed ok");
+is (system("rmdir", "\"$dir\""), 0, "test chroot dir removed ok");