From: Richard D. <ric...@us...> - 2006-10-05 21:45:14
|
Update of /cvsroot/file-extattr/File-Attributes-Extended/t In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv5278/t Added Files: 00-load.t 10-basic.t boilerplate.t pod-coverage.t pod.t Log Message: Module basically works --- NEW FILE: pod-coverage.t --- #!perl -T use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok(); --- NEW FILE: 00-load.t --- #!perl -T use Test::More tests => 1; BEGIN { use_ok( 'File::Attributes::Extended' ); } diag( "Testing File::Attributes::Extended $File::Attributes::Extended::VERSION, Perl $], $^X" ); --- NEW FILE: boilerplate.t --- #!perl -T use strict; use warnings; use Test::More tests => 3; sub not_in_file_ok { my ($filename, %regex) = @_; open my $fh, "<", $filename or die "couldn't open $filename for reading: $!"; my %violated; while (my $line = <$fh>) { while (my ($desc, $regex) = each %regex) { if ($line =~ $regex) { push @{$violated{$desc}||=[]}, $.; } } } if (%violated) { fail("$filename contains boilerplate text"); diag "$_ appears on lines @{$violated{$_}}" for keys %violated; } else { pass("$filename contains no boilerplate text"); } } not_in_file_ok(README => "The README is used..." => qr/The README is used/, "'version information here'" => qr/to provide version information/, ); not_in_file_ok(Changes => "placeholder date/time" => qr(Date/time) ); sub module_boilerplate_ok { my ($module) = @_; not_in_file_ok($module => 'the great new $MODULENAME' => qr/ - The great new /, 'boilerplate description' => qr/Quick summary of what the module/, 'stub function definition' => qr/function[12]/, ); } module_boilerplate_ok('lib/File/Attributes/Extended.pm'); --- NEW FILE: 10-basic.t --- #!perl -w use strict; use Test::More tests => 6; use File::Attributes qw ':all'; use File::Temp qw/tempfile/; use Cwd; my ($fh, $file) = tempfile("basicXXXXXX", DIR => cwd(), UNLINK => 1); set_attribute($file, type => 'text/plain'); set_attribute($file, encoding => 'utf8'); my @attributes = list_attributes($file); is(grep(/^type$/, @attributes), 1); is(grep(/^encoding$/, @attributes), 1); is(scalar(@attributes), 2); my %attributes = get_attributes($file); is($attributes{type}, 'text/plain'); is($attributes{encoding}, 'utf8'); is($attributes{foo}, undef); --- NEW FILE: pod.t --- #!perl -T use Test::More; eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); |