This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Locale::Codes 2.02.
[perl5.git] / lib / Shell.t
CommitLineData
e66df073
JS
1#!./perl
2
dfcfdb64
IZ
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
e66df073
JS
8use Test::More tests => 4;
9
10BEGIN { use_ok('Shell'); }
11
12my $Is_VMS = $^O eq 'VMS';
13my $Is_MSWin32 = $^O eq 'MSWin32';
14my $Is_NetWare = $^O eq 'NetWare';
15
16$Shell::capture_stderr = 1; #
17
18# Now test that that works ..
19
20my $tmpfile = 'sht0001';
21
22while ( -f $tmpfile )
23{
24 $tmpfile++;
25}
26
dfcfdb64 27END { -f $tmpfile && (open STDERR, '>&SAVERR' and unlink $tmpfile) };
e66df073
JS
28
29
30
31open(SAVERR,">&STDERR") ;
32open(STDERR, ">$tmpfile");
33
34xXx(); # Ok someone could have a program called this :(
35
dfcfdb64
IZ
36# On os2 the warning is on by default...
37ok( ($^O eq 'os2' xor !(-s $tmpfile)) ,'$Shell::capture_stderr');
e66df073
JS
38
39$Shell::capture_stderr = 0; #
40
41# someone will have to fill in the blanks for other platforms
42
43if ( $Is_VMS )
44{
72c157b0
PP
45 ok(directory(),'Execute command');
46 my @files = directory('*.*');
47 ok(@files,'Quoted arguments');
e66df073
JS
48}
49elsif( $Is_MSWin32 )
50{
51 ok(dir(),'Execute command');
52
53 my @files = dir('*.*');
54
55 ok(@files, 'Quoted arguments');
56}
57else
58{
59 ok(ls(),'Execute command');
60
61 my @files = ls('*');
62
63 ok(@files,'Quoted arguments');
64
65}
9fb80172 66open(STDERR,">&SAVERR") ;