summaryrefslogtreecommitdiff
path: root/t/comp
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-09 18:35:59 +0200
committerNicholas Clark <nick@ccl4.org>2009-10-09 20:26:18 +0200
commit8b3931378ff96ff45729c95c3ef32a837469a850 (patch)
tree0e5e909a898eb0b6ba9502812c85695600402e66 /t/comp
parent6b077bebea000af2a5477d50d7604bab33ee75c2 (diff)
downloadperl-8b3931378ff96ff45729c95c3ef32a837469a850.tar.gz
Don't use require in comp/multiline.t, as require isn't tested yet.
Emit TAP directly.
Diffstat (limited to 't/comp')
-rw-r--r--t/comp/multiline.t49
1 files changed, 43 insertions, 6 deletions
diff --git a/t/comp/multiline.t b/t/comp/multiline.t
index 6976590c14..fc494843c2 100644
--- a/t/comp/multiline.t
+++ b/t/comp/multiline.t
@@ -1,14 +1,51 @@
#!./perl
-BEGIN {
- chdir 't';
- @INC = '../lib';
- require './test.pl';
+print "1..6\n";
+my $test = 0;
+
+sub failed {
+ my ($got, $expected, $name) = @_;
+
+ print "not ok $test - $name\n";
+ my @caller = caller(1);
+ print "# Failed test at $caller[1] line $caller[2]\n";
+ if (defined $got) {
+ print "# Got '$got'\n";
+ } else {
+ print "# Got undef\n";
+ }
+ print "# Expected $expected\n";
+ return;
}
-plan(tests => 6);
+sub like {
+ my ($got, $pattern, $name) = @_;
+ $test = $test + 1;
+ if (defined $got && $got =~ $pattern) {
+ print "ok $test - $name\n";
+ # Principle of least surprise - maintain the expected interface, even
+ # though we aren't using it here (yet).
+ return 1;
+ }
+ failed($got, $pattern);
+}
+
+sub is {
+ my ($got, $expect, $name) = @_;
+ $test = $test + 1;
+ if (defined $got && $got eq $expect) {
+ print "ok $test - $name\n";
+ return 1;
+ }
+ failed($got, "'$expect'");
+}
+
+my $filename = "multiline$$";
+
+END {
+ 1 while unlink $filename;
+}
-my $filename = tempfile();
open(TRY,'>',$filename) || (die "Can't open $filename: $!");
$x = 'now is the time