# # $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 () { s/[\n\r]//sg; $line++; if (/$pattern/) { $found = 1; last; } } close FILE; return $found ? $line : 0; } 1;