Commit | Line | Data |
a687059c |
1 | #!./perl |
2 | |
72b16652 |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
9b38b307 |
5 | @INC = qw(. ../lib); |
72b16652 |
6 | } |
a687059c |
7 | |
9b38b307 |
8 | require 'test.pl'; |
010be86b |
9 | plan( tests => 15 ); |
a687059c |
10 | |
0a753a76 |
11 | @oops = @ops = <op/*>; |
a687059c |
12 | |
68dc0745 |
13 | if ($^O eq 'MSWin32') { |
3cd616b9 |
14 | map { $files{lc($_)}++ } <op/*>; |
6d0cc0d7 |
15 | map { delete $files{"op/$_"} } split /[\s\n]/, `dir /b /l op & dir /b /l /ah op 2>nul`, |
68dc0745 |
16 | } |
0405c3f2 |
17 | elsif ($^O eq 'VMS') { |
18 | map { $files{lc($_)}++ } <[.op]*>; |
19 | map { s/;.*$//; delete $files{lc($_)}; } split /[\n]/, `directory/noheading/notrailing/versions=1 [.op]`, |
20 | } |
68dc0745 |
21 | else { |
3cd616b9 |
22 | map { $files{$_}++ } <op/*>; |
68dc0745 |
23 | map { delete $files{$_} } split /[\s\n]/, `echo op/*`; |
24 | } |
9b38b307 |
25 | ok( !(keys(%files)),'leftover op/* files' ) or diag(join(' ',sort keys %files)); |
a687059c |
26 | |
9b38b307 |
27 | cmp_ok($/,'eq',"\n",'sane input record separator'); |
a687059c |
28 | |
9b38b307 |
29 | $not = ''; |
7b903762 |
30 | while (<jskdfjskdfj* op/* jskdjfjkosvk*>) { |
31 | $not = "not " unless $_ eq shift @ops; |
32 | $not = "not at all " if $/ eq "\0"; |
a687059c |
33 | } |
9b38b307 |
34 | ok(!$not,"glob amid garbage [$not]"); |
a687059c |
35 | |
9b38b307 |
36 | cmp_ok($/,'eq',"\n",'input record separator still sane'); |
0a753a76 |
37 | |
7b903762 |
38 | $_ = "op/*"; |
0a753a76 |
39 | @glops = glob $_; |
9b38b307 |
40 | cmp_ok("@glops",'eq',"@oops",'glob operator 1'); |
0a753a76 |
41 | |
42 | @glops = glob; |
9b38b307 |
43 | cmp_ok("@glops",'eq',"@oops",'glob operator 2'); |
ba112943 |
44 | |
45 | # glob should still work even after the File::Glob stash has gone away |
46 | # (this used to dump core) |
47 | my $i = 0; |
48 | for (1..2) { |
49 | eval "<.>"; |
9b38b307 |
50 | ok(!length($@),"eval'ed a glob $_"); |
ba112943 |
51 | undef %File::Glob::; |
52 | ++$i; |
53 | } |
9b38b307 |
54 | cmp_ok($i,'==',2,'remore File::Glob stash'); |
fe4a5e1f |
55 | |
48beb55f |
56 | # ... while ($var = glob(...)) should test definedness not truth |
57 | |
9b38b307 |
58 | SKIP: { |
59 | skip('no File::Glob to emulate Unix-ism', 1) |
60 | unless $INC{'File/Glob.pm'}; |
61 | my $ok = 0; |
62 | $ok = 1 while my $var = glob("0"); |
63 | ok($ok,'define versus truth'); |
6ffa69ae |
64 | } |
ed2962a1 |
65 | |
66 | # The formerly-broken test for the situation above would accidentally |
67 | # test definedness for an assignment with a LOGOP on the right: |
33cec765 |
68 | { |
9b38b307 |
69 | my $f = 0; |
70 | my $ok = 1; |
71 | $ok = 0, undef $f while $x = $f||$f; |
72 | ok($ok,'test definedness with LOGOP'); |
33cec765 |
73 | } |
9b38b307 |
74 | |
75 | cmp_ok(scalar(@oops),'>',0,'glob globbed something'); |
010be86b |
76 | |
77 | *aieee = 4; |
78 | pass('Can assign integers to typeglobs'); |
79 | *aieee = 3.14; |
80 | pass('Can assign floats to typeglobs'); |
81 | *aieee = 'pi'; |
82 | pass('Can assign strings to typeglobs'); |