3 use Test::More tests => 7;
5 BEGIN { use_ok('Shell'); }
10 my $Is_VMS = $^O eq 'VMS';
11 my $Is_MSWin32 = $^O eq 'MSWin32';
12 my $Is_NetWare = $^O eq 'NetWare';
14 $Shell::capture_stderr = 1;
16 # Now test that that works ..
18 my $tmpfile = 'sht0001';
19 while ( -f $tmpfile ) {
22 END { -f $tmpfile && (open STDERR, '>&SAVERR' and unlink $tmpfile) }
25 # no false warning about Name "main::SAVERR" used only once: possible typo
27 open(SAVERR, ">&STDERR");
28 open(STDERR, ">$tmpfile");
30 xXx_not_there(); # Ok someone could have a program called this :(
32 # On os2 the warning is on by default...
33 ok(($^O eq 'os2' xor !(-s $tmpfile)), '$Shell::capture_stderr');
35 $Shell::capture_stderr = 0;
37 # someone will have to fill in the blanks for other platforms
40 ok(directory(), 'Execute command');
41 my @files = directory('*.*');
42 ok(@files, 'Quoted arguments');
44 ok(eq_array(\@files, [$so->directory('*.*')]), 'object method');
45 eval { $so->directory };
46 ok(!$@, '2 methods calls');
47 } elsif ($Is_MSWin32) {
48 ok(dir(), 'Execute command');
49 my @files = dir('*.*');
50 ok(@files, 'Quoted arguments');
52 ok(eq_array(\@files, [$so->dir('*.*')]), 'object method');
54 ok(!$@, '2 methods calls');
56 ok(ls(), 'Execute command');
58 ok(@files, 'Quoted arguments');
60 ok(eq_array(\@files, [$so->ls('*')]), 'object method');
62 ok(!$@, '2 methods calls');
65 open(STDERR, ">&SAVERR") ;