7 my ($got, $expected, $name) = @_;
9 print "not ok $test - $name\n";
10 my @caller = caller(1);
11 print "# Failed test at $caller[1] line $caller[2]\n";
13 print "# Got '$got'\n";
15 print "# Got undef\n";
17 print "# Expected $expected\n";
22 my ($got, $pattern, $name) = @_;
24 if (defined $got && $got =~ $pattern) {
25 print "ok $test - $name\n";
26 # Principle of least surprise - maintain the expected interface, even
27 # though we aren't using it here (yet).
30 failed($got, $pattern, $name);
34 my ($got, $expect, $name) = @_;
36 if (defined $got && $got eq $expect) {
37 print "ok $test - $name\n";
40 failed($got, "'$expect'", $name);
43 my $filename = "multiline$$";
46 1 while unlink $filename;
49 open(TRY,'>',$filename) || (die "Can't open $filename: $!");
60 $y = 'now is the time' . "\n" .
61 'for all good men' . "\n" .
62 'to come to.' . "\n\n\n!\n\n";
64 is($x, $y, 'test data is sane');
67 close TRY or die "Could not close: $!";
69 open(TRY,$filename) || (die "Can't reopen $filename: $!");
77 is($z, $y, 'basic multiline reading');
79 is($count, 7, ' line count');
82 $out = (($^O eq 'MSWin32') || $^O eq 'NetWare') ? `type $filename`
83 : ($^O eq 'VMS') ? `type $filename.;0` # otherwise .LIS is assumed
86 like($out, qr/.*\n.*\n.*\n$/);
88 close(TRY) || (die "Can't close $filename: $!");