File: shell_guess__os_win32.t

package info (click to toggle)
libshell-guess-perl 0.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 256 kB
  • sloc: perl: 166; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 901 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use strict;
use warnings;
use Test::More;

plan skip_all => 'windows only test' unless $^O eq 'MSWin32';
plan tests => 4;

my $fake_is_win95 = 0;

eval q{
  package Win32;

  $INC{'Win32.pm'} = __FILE__;

  no warnings;
  sub IsWin95 { $fake_is_win95 ? 1 : 0 }
  sub IsWinNT { $fake_is_win95 ? 0 : 1 }
};
die $@ if $@;

eval q{ use Shell::Guess };
die $@ if $@;

do {
  local $ENV{ComSpec} = 'C:\\Windows\\system32\\cmd.exe';
  is eval { Shell::Guess->running_shell->is_cmd }, 1, "running cmd.exe";
  diag $@ if $@;
};

do {
  local $ENV{ComSpec} = 'C:\\Windows\\system32\\command.exe';
  is eval { Shell::Guess->running_shell->is_command }, 1, "running command.com";
  diag $@ if $@;
};

$fake_is_win95 = 1;
is eval { Shell::Guess->login_shell->is_command }, 1, 'login command.com';
diag $@ if $@;

$fake_is_win95 = 0;
is eval { Shell::Guess->login_shell->is_cmd }, 1, 'login cmd.exe';
diag $@ if $@;