chronicle-4.6/ 0000755 0001750 0001750 00000000000 11557771306 011541 5 ustar skx skx chronicle-4.6/tests/ 0000755 0001750 0001750 00000000000 11557771306 012703 5 ustar skx skx chronicle-4.6/tests/perl-syntax.t 0000755 0001750 0001750 00000002773 11557771306 015372 0 ustar skx skx #!/usr/bin/perl -w
#
# Test that every perl file we have passes the syntax check.
#
# Steve
# --
use strict;
use File::Find;
use Test::More qw( no_plan );
#
# Find all the files beneath the current directory,
# and call 'checkFile' with the name.
#
find( { wanted => \&checkFile, no_chdir => 1 }, '.' );
#
# Check a file.
#
# If this is a perl file then call "perl -c $name", otherwise
# return
#
sub checkFile
{
# The file.
my $file = $File::Find::name;
# We don't care about directories
return if ( ! -f $file );
# Or makefiles
return if ( $file =~ /Makefile/ );
# False positives
return if ( ( $file =~ /modules.sh$/ ) ||
( $file =~ /html-validator.t/ ) ||
( $file =~ /blog/ ) ||
( $file =~ /output/ ) );
# See if it is a perl file.
my $isPerl = 0;
# Read the file.
open( INPUT, "<", $file );
foreach my $line ( )
{
if ( $line =~ /\/usr\/bin\/perl/ )
{
$isPerl = 1;
}
}
close( INPUT );
#
# Return if it wasn't a perl file.
#
return if ( ! $isPerl );
#
# Now run 'perl -c $file' to see if we pass the syntax
# check. We add a couple of parameters to make sure we're
# really OK.
#
# use strict "vars";
# use strict "subs";
#
my $retval = system( "perl -Mstrict=subs -Mstrict=vars -c $file 2>/dev/null >/dev/null" );
is( $retval, 0, "Perl file passes our syntax check: $file" );
}
chronicle-4.6/tests/pod-check.t 0000755 0001750 0001750 00000001320 11557771306 014724 0 ustar skx skx #!/usr/bin/perl -w
#
# Test that the POD we include in our scripts is valid, via the external
# podcheck command.
#
# Steve
# --
#
use strict;
use Test::More qw( no_plan );
foreach my $file ( qw! ./bin/chronicle ! )
{
ok( -e $file, "$file" );
ok( -x $file, " File is executable: $file" );
ok( ! -d $file, " File is not a directory: $file" );
if ( ( -x $file ) && ( ! -d $file ) )
{
#
# Execute the command giving STDERR to STDOUT where we
# can capture it.
#
my $cmd = "podchecker $file";
my $output = `$cmd 2>&1`;
chomp( $output );
is( $output, "$file pod syntax OK.", " File has correct POD syntax: $file" );
}
}
chronicle-4.6/tests/pod.t 0000644 0001750 0001750 00000000451 11557771306 013652 0 ustar skx skx #!/usr/bin/perl -w
#
# Test that the POD we use in our modules is valid.
#
use strict;
use Test::More;
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
#
# Run the test(s).
#
my @poddirs = qw( bin );
all_pod_files_ok( all_pod_files( @poddirs ) );
chronicle-4.6/tests/html-validator.t 0000755 0001750 0001750 00000003373 11557771306 016030 0 ustar skx skx #!/usr/bin/perl -w
#
# Test that our output is validatored
#
# Steve
# --
use File::Find;
use HTML::Lint;
use Test::More;
#
# Basically this test validates the HTML which would be produced if
# a blog is compiled - if one is not present then we have nothing to
# validate against.
#
if ( -d "./output/" )
{
plan no_plan;
}
else
{
plan skip_all => 'There is no output directory to validate against!';
exit;
}
#
# Find all the files beneath the current directory,
# and call 'checkFile' with the name.
#
find( { wanted => \&checkFile, no_chdir => 1 }, './output/' );
#
# Check a file.
#
#
sub checkFile
{
# The file.
my $file = $File::Find::name;
# We don't care about directories
return if ( ! -f $file );
# We only care about html files.
return if ( $file !~ /\.html$/ );
my $lint = HTML::Lint->new;
$lint->parse_file( $file );
my $error_count = $lint->errors;
foreach my $error ( $lint->errors ) {
if ( $error->as_string =~ // )
{
$error_count -= 1;
}
if ( $error->as_string =~ /Invalid character/ )
{
$error_count -= 1;
}
# print $error->as_string, "\n";
}
is( $error_count, 0 , "There are no errors in $file" );
}
#
# Count and return the number of literal TAB characters contained
# in the specified file.
#
sub countTabCharacters
{
my ( $file ) = (@_);
my $count = 0;
open( FILE, "<", $file )
or die "Cannot open $file - $!";
foreach my $line ( )
{
# We will count multiple tab characters in a single line.
while( $line =~ /(.*)\t(.*)/ )
{
$count += 1;
$line = $1 . $2;
}
}
close( FILE );
return( $count );
}
chronicle-4.6/tests/no-tabs.t 0000755 0001750 0001750 00000003711 11557771306 014440 0 ustar skx skx #!/usr/bin/perl -w
#
# Test that none of our scripts contain any literal TAB characters.
#
# Steve
# --
use strict;
use File::Find;
use Test::More qw( no_plan );
#
# Find all the files beneath the current directory,
# and call 'checkFile' with the name.
#
find( { wanted => \&checkFile, no_chdir => 1 }, '.' );
#
# Check a file.
#
#
sub checkFile
{
# The file.
my $file = $File::Find::name;
# We don't care about directories
return if ( ! -f $file );
# Nor about backup files.
return if ( $file =~ /~$/ );
# or Makefiles
return if ( $file =~ /Makefile$/ );
# Nor about files which start with ./debian/
return if ( $file =~ /^\.\/debian\// );
return if ( $file =~ /^\.\/blog\// );
return if ( $file =~ /^\.\/output\// );
# See if it is a shell/perl file.
my $isShell = 0;
my $isPerl = 0;
# Read the file.
open( INPUT, "<", $file );
foreach my $line ( )
{
if ( ( $line =~ /\/bin\/sh/ ) ||
( $line =~ /\/bin\/bash/ ) )
{
$isShell = 1;
}
if ( $line =~ /\/usr\/bin\/perl/ )
{
$isPerl = 1;
}
}
close( INPUT );
#
# We don't care about files which are neither perl nor shell.
#
if ( $isShell || $isPerl )
{
#
# Count TAB characters
#
my $count = countTabCharacters( $file );
is( $count, 0, "Script has no tab characters: $file" );
}
}
#
# Count and return the number of literal TAB characters contained
# in the specified file.
#
sub countTabCharacters
{
my ( $file ) = (@_);
my $count = 0;
open( FILE, "<", $file )
or die "Cannot open $file - $!";
foreach my $line ( )
{
# We will count multiple tab characters in a single line.
while( $line =~ /(.*)\t(.*)/ )
{
$count += 1;
$line = $1 . $2;
}
}
close( FILE );
return( $count );
}
chronicle-4.6/tests/Makefile 0000644 0001750 0001750 00000000245 11557771306 014344 0 ustar skx skx
all:
@cd ..; prove --shuffle tests/
verbose:
@cd ..; prove --shuffle --verbose tests/
modules: .PHONY
./modules.sh > modules.t
.PHONY:
true
clean:
rm *~
chronicle-4.6/tests/modules.sh 0000755 0001750 0001750 00000001104 11557771306 014706 0 ustar skx skx #!/bin/sh
#
# Automatically attempt to create a test which ensures all the modules
# used in the code are availabe.
#
# Steve
# --
# http://www.steve.org.uk/
#
#
cat <