4 if( $ENV{PERL_CORE} ) {
10 use Test::More tests => 7;
12 BEGIN { use_ok('Shell'); }
15 ok($so, 'Shell->new');
17 my $Is_VMS = $^O eq 'VMS';
18 my $Is_MSWin32 = $^O eq 'MSWin32';
19 my $Is_NetWare = $^O eq 'NetWare';
21 $Shell::capture_stderr = 1;
23 # Now test that that works ..
25 my $tmpfile = 'sht0001';
26 while ( -f $tmpfile ) {
29 END { -f $tmpfile && (open STDERR, '>&SAVERR' and unlink $tmpfile) }
32 # no false warning about Name "main::SAVERR" used only once: possible typo
34 open(SAVERR, ">&STDERR");
35 open(STDERR, ">$tmpfile");
37 xXx_not_there(); # Ok someone could have a program called this :(
39 # On os2 the warning is on by default...
40 ok(($^O eq 'os2' xor !(-s $tmpfile)), '$Shell::capture_stderr');
42 $Shell::capture_stderr = 0;
44 # Trying to do two repeated C<ls>s in t in core and expecting the same output
45 # is a race condition when tests are running in parallel, and using it as a
46 # temporary directory. So go somewhere quieter.
47 chdir 'uni' if $ENV{PERL_CORE} && -d 'uni';
49 # someone will have to fill in the blanks for other platforms
52 ok(directory(), 'Execute command');
53 my @files = directory('*.*');
54 ok(@files, 'Quoted arguments');
56 ok(eq_array(\@files, [$so->directory('*.*')]), 'object method');
57 eval { $so->directory };
58 ok(!$@, '2 methods calls');
59 } elsif ($Is_MSWin32) {
60 ok(dir(), 'Execute command');
61 my @files = dir('*.*');
62 ok(@files, 'Quoted arguments');
64 ok(eq_array(\@files, [$so->dir('*.*')]), 'object method');
66 ok(!$@, '2 methods calls');
68 ok(ls(), 'Execute command');
70 ok(@files, 'Quoted arguments');
72 ok(eq_array(\@files, [$so->ls('*')]), 'object method');
74 ok(!$@, '2 methods calls');
77 open(STDERR, ">&SAVERR") ;