Cygwin::mount_table, Cygwin::mount_flags
[p5sagit/p5-mst-13.2.git] / t / lib / cygwin.t
index 18ada21..3623f9a 100644 (file)
@@ -9,7 +9,7 @@ BEGIN {
     }
 }
 
-use Test::More tests => 8;
+use Test::More tests => 14;
 
 is(Cygwin::winpid_to_pid(Cygwin::pid_to_winpid($$)), $$,
    "perl pid translates to itself");
@@ -35,9 +35,27 @@ is(Cygwin::posix_to_win_path("t/lib"), "t\\lib", "posix to win path: t\\lib");
 
 use Win32;
 use Cwd;
-$pwd = getcwd();
+my $pwd = getcwd();
 chdir("/");
-$winpath = Win32::GetCwd();
+my $winpath = Win32::GetCwd();
 is(Cygwin::posix_to_win_path("/", 1), $winpath, "posix to absolute win path");
 chdir($pwd);
 is(Cygwin::win_to_posix_path($winpath, 1), "/", "win to absolute posix path");
+
+my $mount = join '', `/usr/bin/mount`;
+$mount =~ m|on /usr/bin type .+ \((\w+mode)\)|m;
+my $binmode = $1 eq 'binmode';
+is(Cygwin::is_binmount("/"),  $binmode ? 1 : '', "check / for binmount");
+is(Cygwin::is_textmount("/"), $binmode ? '' : 1, "check / for textmount");
+
+my $rootmnt = Cygwin::mount_flags("/");
+ok($binmode ? ($rootmnt =~ /,binmode/) : ($rootmnt =~ /,textmode/), "check / mount_flags");
+is(Cygwin::mount_flags("/cygdrive") =~ /,cygdrive/,  1, "check cygdrive mount_flags");
+
+my @mnttbl = Cygwin::mount_table();
+ok(@mnttbl > 0, "non empty mount_table");
+for $i (@mnttbl) {
+  if ($i->[0] eq '/') {
+    is($i->[2].",".$i->[3], $rootmnt, "same root mount flags");
+  }
+}