From: Nicholas Clark Date: Wed, 9 Jan 2008 22:36:21 +0000 (+0000) Subject: grep the MANIFEST to avoid having hard coded numbers in readdir.t X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=89eb5450df838ee8565c99567ce367f194dbe60f;p=p5sagit%2Fp5-mst-13.2.git grep the MANIFEST to avoid having hard coded numbers in readdir.t p4raw-id: //depot/perl@32930 --- diff --git a/t/op/readdir.t b/t/op/readdir.t index 971a02a..53c7b68 100755 --- a/t/op/readdir.t +++ b/t/op/readdir.t @@ -20,11 +20,12 @@ if (opendir(OP, "op")) { print "ok 1\n"; } else { print "not ok 1\n"; } @D = grep(/^[^\.].*\.t$/i, readdir(OP)); closedir(OP); -## -## This range will have to adjust as the number of tests expands, -## as it's counting the number of .t files in src/t -## -my ($min, $max) = (150, 170); +open $man, "<../MANIFEST" or die "Can't open ../MANIFEST: $!"; +my $expect; +while (<$man>) { + ++$expect if m!^t/op/[^/]+\t!; +} +my ($min, $max) = ($expect - 10, $expect + 10); if (@D > $min && @D < $max) { print "ok 2\n"; } else { printf "not ok 2 # counting op/*.t, expect $min < %d < $max files\n",