summaryrefslogtreecommitdiff
path: root/ext/Errno/t
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2006-09-07 02:07:57 +0000
committerSteve Peters <steve@fisharerojo.org>2006-09-07 02:07:57 +0000
commiteb0f98c9231fa500029e4f3531ee246d1650a240 (patch)
tree04aeb8c0eae0d5e3d55b87a989c48b4099a658be /ext/Errno/t
parentdf43650bac48846555252ca61d5394988cdf564f (diff)
downloadperl-eb0f98c9231fa500029e4f3531ee246d1650a240.tar.gz
Convert Errno.t to Test::More. Increase the test coverage
while in there as well. p4raw-id: //depot/perl@28794
Diffstat (limited to 'ext/Errno/t')
-rwxr-xr-xext/Errno/t/Errno.t59
1 files changed, 24 insertions, 35 deletions
diff --git a/ext/Errno/t/Errno.t b/ext/Errno/t/Errno.t
index a6b08e03f9..16d5cb0de9 100755
--- a/ext/Errno/t/Errno.t
+++ b/ext/Errno/t/Errno.t
@@ -1,4 +1,4 @@
-#!./perl
+#!./perl -w
BEGIN {
unless(grep /blib/, @INC) {
@@ -11,48 +11,37 @@ BEGIN {
}
}
-use Errno;
+use Test::More tests => 10;
-print "1..6\n";
+BEGIN {
+ use_ok("Errno");
+}
-print "not " unless @Errno::EXPORT_OK;
-print "ok 1\n";
-die unless @Errno::EXPORT_OK;
+BAIL_OUT("No errno's are exported") unless @Errno::EXPORT_OK;
-$err = $Errno::EXPORT_OK[0];
-$num = &{"Errno::$err"};
+my $err = $Errno::EXPORT_OK[0];
+my $num = &{"Errno::$err"};
-print "not " unless &{"Errno::$err"} == $num;
-print "ok 2\n";
+is($num, &{"Errno::$err"});
$! = $num;
-# Some systems have ESUCCESS 0, that's why exists instead of boolean.
-print "not " unless exists $!{$err};
-print "ok 3\n";
+ok(exists $!{$err});
$! = 0;
-print "not " if $!{$err};
-print "ok 4\n";
-
-$s1 = join(",",sort keys(%!));
-$s2 = join(",",sort @Errno::EXPORT_OK);
-
-if($s1 ne $s2) {
- my @s1 = keys(%!);
- my @s2 = @Errno::EXPORT_OK;
- my(%s1,%s2);
- @s1{@s1} = ();
- @s2{@s2} = ();
- delete @s2{@s1};
- delete @s1{@s2};
- print "# These are only in \%!\n";
- print "# ",join(" ",map { "'$_'" } keys %s1),"\n";
- print "# These are only in \@EXPORT_OK\n";
- print "# ",join(" ",map { "'$_'" } keys %s2),"\n";
- print "not ";
-}
+ok(! $!{$err});
-print "ok 5\n";
+ok(join(",",sort keys(%!)) eq join(",",sort @Errno::EXPORT_OK));
eval { exists $!{[]} };
-print $@ ? "not ok 6\n" : "ok 6\n";
+ok(! $@);
+
+eval {$!{$err} = "qunckkk" };
+like($@, qr/^ERRNO hash is read only!/);
+
+eval {delete $!{$err}};
+like($@, qr/^ERRNO hash is read only!/);
+
+# The following tests are in trouble if some OS picks errno values
+# through Acme::MetaSyntactic::batman
+is($!{EFLRBBB}, "");
+ok(! exists($!{EFLRBBB}));