Commit | Line | Data |
8d063cd8 |
1 | #!./perl |
2 | |
853410bb |
3 | BEGIN { |
7bbfeec9 |
4 | chdir 't'; |
5 | @INC = '../lib'; |
6 | require './test.pl'; |
7 | } |
8d063cd8 |
8 | |
7bbfeec9 |
9 | plan(tests => 6); |
8d063cd8 |
10 | |
7bbfeec9 |
11 | open(TRY,'>Comp.try') || (die "Can't open temp file."); |
8d063cd8 |
12 | |
13 | $x = 'now is the time |
14 | for all good men |
15 | to come to. |
c6f14548 |
16 | |
17 | |
18 | ! |
19 | |
8d063cd8 |
20 | '; |
21 | |
22 | $y = 'now is the time' . "\n" . |
23 | 'for all good men' . "\n" . |
c6f14548 |
24 | 'to come to.' . "\n\n\n!\n\n"; |
8d063cd8 |
25 | |
7bbfeec9 |
26 | is($x, $y, 'test data is sane'); |
8d063cd8 |
27 | |
7bbfeec9 |
28 | print TRY $x; |
d1e4d418 |
29 | close TRY or die "Could not close: $!"; |
8d063cd8 |
30 | |
7bbfeec9 |
31 | open(TRY,'Comp.try') || (die "Can't reopen temp file."); |
8d063cd8 |
32 | $count = 0; |
33 | $z = ''; |
7bbfeec9 |
34 | while (<TRY>) { |
8d063cd8 |
35 | $z .= $_; |
36 | $count = $count + 1; |
37 | } |
38 | |
7bbfeec9 |
39 | is($z, $y, 'basic multiline reading'); |
8d063cd8 |
40 | |
7bbfeec9 |
41 | is($count, 7, ' line count'); |
42 | is($., 7, ' $.' ); |
8d063cd8 |
43 | |
7bbfeec9 |
44 | $out = (($^O eq 'MSWin32') || $^O eq 'NetWare' || $^O eq 'VMS') ? `type Comp.try` |
95e8664e |
45 | : ($^O eq 'MacOS') ? `catenate Comp.try` |
46 | : `cat Comp.try`; |
8d063cd8 |
47 | |
7bbfeec9 |
48 | like($out, qr/.*\n.*\n.*\n$/); |
bbad3607 |
49 | |
7bbfeec9 |
50 | close(TRY) || (die "Can't close temp file."); |
a0d0e21e |
51 | unlink 'Comp.try' || `/bin/rm -f Comp.try`; |
8d063cd8 |
52 | |
7bbfeec9 |
53 | is($out, $y); |