Add ARM files
[dh-make-perl] / dev / arm / libfile-chdir-perl / libfile-chdir-perl-0.06 / t / var.t
diff --git a/dev/arm/libfile-chdir-perl/libfile-chdir-perl-0.06/t/var.t b/dev/arm/libfile-chdir-perl/libfile-chdir-perl-0.06/t/var.t
new file mode 100644 (file)
index 0000000..7465ee8
--- /dev/null
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -Tw
+
+use strict;
+use lib qw(t/lib);
+use Test::More tests => 11;
+
+BEGIN { use_ok('File::chdir') }
+
+use Cwd;
+
+# Don't want to depend on File::Spec::Functions
+sub catdir { File::Spec->catdir(@_) }
+
+my $cwd = getcwd;
+
+ok( tied $CWD,      '$CWD is fit to be tied' );
+
+# First, let's try unlocalized $CWD.
+{
+    $CWD = 't';
+    ::is( getcwd, catdir($cwd,'t'), 'unlocalized $CWD works' );
+    ::is( $CWD,   catdir($cwd,'t'), '  $CWD set' );
+}
+
+::is( getcwd, catdir($cwd,'t'), 'unlocalized $CWD unneffected by blocks' );
+::is( $CWD,   catdir($cwd,'t'), '  and still set' );
+
+
+# Ok, reset ourself for the real test.
+$CWD = $cwd;
+
+{
+    my $old_dir = $CWD;
+    local $CWD = "t";
+    ::is( $old_dir, $cwd,           '$CWD fetch works' );
+    ::is( getcwd, catdir($cwd,'t'), 'localized $CWD works' );
+}
+
+::is( getcwd, $cwd,                 '  and resets automatically!' );
+::is( $CWD,   $cwd,                 '  $CWD reset, too' );
+
+
+chdir('t');
+is( $CWD,   catdir($cwd,'t'),       'chdir() and $CWD work together' );