From 47c7161386557a880f7d0b0c17a90bc530cce1fb Mon Sep 17 00:00:00 2001 From: steve Date: Tue, 4 Sep 2007 20:30:25 +0000 Subject: [PATCH] 2007-09-04 20:30:25 by steve Added new tests for our modular code. --- t/00-load.t | 10 ++++++++++ t/getopt.t | 5 ++++- t/pod-coverage.t | 18 ++++++++++++++++++ t/pod.t | 16 +++++++++------- t/xen-tools-log.t | 17 +++++++++++++++++ t/xen-tools.t | 15 +++++++++++++++ 6 files changed, 73 insertions(+), 8 deletions(-) create mode 100755 t/00-load.t create mode 100755 t/pod-coverage.t create mode 100755 t/xen-tools-log.t create mode 100755 t/xen-tools.t diff --git a/t/00-load.t b/t/00-load.t new file mode 100755 index 0000000..8453394 --- /dev/null +++ b/t/00-load.t @@ -0,0 +1,10 @@ +#!/usr/bin/perl -I../lib -I./lib + +use Test::More tests => 2; + +BEGIN { + use_ok( 'Xen::Tools' ); + use_ok( 'Xen::Tools::Log' ); +} + +diag( "Testing Xen::Tools $Xen::Tools::VERSION, Perl $], $^X" ); diff --git a/t/getopt.t b/t/getopt.t index d6be6bb..8a2296c 100755 --- a/t/getopt.t +++ b/t/getopt.t @@ -7,7 +7,7 @@ # # Steve # -- -# $Id: getopt.t,v 1.1 2007-09-01 19:23:10 steve Exp $ +# $Id: getopt.t,v 1.2 2007-09-04 20:30:25 steve Exp $ use strict; @@ -20,6 +20,9 @@ use Test::More qw( no_plan ); # foreach my $file ( sort( glob "./bin/*-*" ) ) { + # Skip emacs and CVS backups + next if $file =~ /~$/; + testFile( $file ); } diff --git a/t/pod-coverage.t b/t/pod-coverage.t new file mode 100755 index 0000000..1228711 --- /dev/null +++ b/t/pod-coverage.t @@ -0,0 +1,18 @@ +use strict; +use warnings; +use Test::More; + +# Ensure a recent version of Test::Pod::Coverage +my $min_tpc = 1.08; +eval "use Test::Pod::Coverage $min_tpc"; +plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" + if $@; + +# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, +# but older versions don't recognize some common documentation styles +my $min_pc = 0.17; +eval "use Pod::Coverage $min_pc"; +plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" + if $@; + +all_pod_coverage_ok(); diff --git a/t/pod.t b/t/pod.t index ee581f3..3cb8f9c 100755 --- a/t/pod.t +++ b/t/pod.t @@ -1,17 +1,19 @@ -#!/usr/bin/perl -w - +#!/usr/bin/perl # # Test that the POD we use in our modules is valid. # - use strict; +use warnings; use Test::More; -eval "use Test::Pod 1.00"; -plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; + +# Ensure a recent version of Test::Pod +my $min_tp = 1.08; +eval "use Test::Pod $min_tp"; + +plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; # # Run the test(s). # -my @poddirs = qw( bin ); -all_pod_files_ok( all_pod_files( @poddirs ) ); +all_pod_files_ok(); diff --git a/t/xen-tools-log.t b/t/xen-tools-log.t new file mode 100755 index 0000000..f515909 --- /dev/null +++ b/t/xen-tools-log.t @@ -0,0 +1,17 @@ +#!/usr/bin/perl -I../lib -I./lib + +use strict; +use warnings; +use Test::More tests => 1; +use File::Temp; + +use Xen::Tools::Log; + +my $dir = File::Temp::tempdir( CLEANUP => 1 ); + +my $xtl = Xen::Tools::Log->new( hostname => 'xen-tools-log-test', + logpath => $dir, + ); + +ok( $xtl->isa('Xen::Tools::Log') ); + diff --git a/t/xen-tools.t b/t/xen-tools.t new file mode 100755 index 0000000..8a30b68 --- /dev/null +++ b/t/xen-tools.t @@ -0,0 +1,15 @@ +#!/usr/bin/perl -I../lib -I./lib +# +# Test we can load the (stub) Xen::Tools package. +# + + +use strict; +use warnings; +use Test::More tests => 1; + +use Xen::Tools; + +my $xt = Xen::Tools->new( hostname => 'xen-tools-test' ); + +ok( $xt->isa('Xen::Tools') );