1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#
# $Id: code.pl,v 1.2 2004/02/02 04:11:27 wendigo Exp $
#
# Copyright (c) 1999, Raphael Manfredi
#
# You may redistribute only under the terms of the Artistic License,
# as specified in the README file that comes with the distribution.
#
# HISTORY
# $Log: code.pl,v $
# Revision 1.2 2004/02/02 04:11:27 wendigo
# Stripped line endings from common tests to allow success on non-UN*X
# platforms.
#
# Revision 1.1 2002/03/09 16:16:55 wendigo
# New maintainer
#
# Revision 0.2 2000/11/06 19:30:33 ram
# Baseline for second Alpha release.
#
# $EndLog$
#
sub ok {
my ($num, $ok) = @_;
print "not " unless $ok;
print "ok $num\n";
}
sub contains {
my ($file, $pattern) = @_;
local *FILE;
local $_;
open(FILE, $file) || die "can't open $file: $!\n";
my $found = 0;
my $line = 0;
while (<FILE>) {
s/[\n\r]//sg;
$line++;
if (/$pattern/) {
$found = 1;
last;
}
}
close FILE;
return $found ? $line : 0;
}
1;
|