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