diff options
author | dakkar <dakkar@sardina.(none)> | 2009-04-30 21:50:05 +0200 |
---|---|---|
committer | dakkar <dakkar@sardina.(none)> | 2009-04-30 21:50:05 +0200 |
commit | a2ad1449e5f0fa52c03c486966131b5528f2a04a (patch) | |
tree | 37037ff63bc337e374481c6033e07b022c1ffec6 /t | |
parent | added a prerq I had forgotten (diff) | |
parent | better perl version requirements (diff) | |
download | Tree-Transform-XSLTish-a2ad1449e5f0fa52c03c486966131b5528f2a04a.tar.gz Tree-Transform-XSLTish-a2ad1449e5f0fa52c03c486966131b5528f2a04a.tar.bz2 Tree-Transform-XSLTish-a2ad1449e5f0fa52c03c486966131b5528f2a04a.zip |
Merge branch 'master' of git@luxion:Tree-Transform-XSLTish
Conflicts:
Makefile.PL
Diffstat (limited to 't')
-rw-r--r-- | t/00-author-critic.t | 35 | ||||
-rw-r--r-- | t/00-author-minver.t | 33 | ||||
-rw-r--r-- | t/00-author-pod.t | 33 | ||||
-rw-r--r-- | t/01-basic.t | 5 | ||||
-rw-r--r-- | t/02-inherit.t | 14 | ||||
-rw-r--r-- | t/03-byname.t | 5 | ||||
-rw-r--r-- | t/04-errors.t | 5 | ||||
-rw-r--r-- | t/05-html-tree.t | 6 | ||||
-rw-r--r-- | t/perlcriticrc | 122 |
9 files changed, 237 insertions, 21 deletions
diff --git a/t/00-author-critic.t b/t/00-author-critic.t new file mode 100644 index 0000000..79ed2b7 --- /dev/null +++ b/t/00-author-critic.t @@ -0,0 +1,35 @@ +#!/usr/bin/perl + +# Test that the module passes perlcritic +use strict; +BEGIN { + $| = 1; + $^W = 1; +} + +my @MODULES = ( + 'Perl::Critic 1.098', + 'Test::Perl::Critic 1.01', + 'File::Spec', +); + +# Don't run tests during end-user installs +use Test::More; +unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ) { + plan( skip_all => "Author tests not required for installation" ); +} + +# Load the testing modules +foreach my $MODULE ( @MODULES ) { + eval "use $MODULE"; + if ( $@ ) { + $ENV{RELEASE_TESTING} + ? die( "Failed to load required release-testing module $MODULE" ) + : plan( skip_all => "$MODULE not available for testing" ); + } +} +my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' ); +Test::Perl::Critic->import( -profile => $rcfile ); +all_critic_ok(); + +1; diff --git a/t/00-author-minver.t b/t/00-author-minver.t new file mode 100644 index 0000000..4dfb876 --- /dev/null +++ b/t/00-author-minver.t @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +# Test that our declared minimum Perl version matches our syntax +use strict; +BEGIN { + $| = 1; + $^W = 1; +} + +my @MODULES = ( + 'Perl::MinimumVersion 1.20', + 'Test::MinimumVersion 0.008', +); + +# Don't run tests during end-user installs +use Test::More; +unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ) { + plan( skip_all => "Author tests not required for installation" ); +} + +# Load the testing modules +foreach my $MODULE ( @MODULES ) { + eval "use $MODULE"; + if ( $@ ) { + $ENV{RELEASE_TESTING} + ? die( "Failed to load required release-testing module $MODULE" ) + : plan( skip_all => "$MODULE not available for testing" ); + } +} + +all_minimum_version_from_metayml_ok(); + +1; diff --git a/t/00-author-pod.t b/t/00-author-pod.t new file mode 100644 index 0000000..2cdfcc4 --- /dev/null +++ b/t/00-author-pod.t @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +# Test that the syntax of our POD documentation is valid +use strict; +BEGIN { + $| = 1; + $^W = 1; +} + +my @MODULES = ( + 'Pod::Simple 3.07', + 'Test::Pod 1.26', +); + +# Don't run tests during end-user installs +use Test::More; +unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ) { + plan( skip_all => "Author tests not required for installation" ); +} + +# Load the testing modules +foreach my $MODULE ( @MODULES ) { + eval "use $MODULE"; + if ( $@ ) { + $ENV{RELEASE_TESTING} + ? die( "Failed to load required release-testing module $MODULE" ) + : plan( skip_all => "$MODULE not available for testing" ); + } +} + +all_pod_files_ok(); + +1; diff --git a/t/01-basic.t b/t/01-basic.t index a6670a5..a8e2474 100644 --- a/t/01-basic.t +++ b/t/01-basic.t @@ -32,14 +32,11 @@ package OtherTransform;{ } package main; -use Test::Most qw(no_plan die); +use Test::Most tests=>2,'die'; use strict; use warnings; use Tree::DAG_Node::XPath; -sub Tree::DAG_Node::XPath::Root::xpath_get_root_node { return $_[0] } -sub Tree::DAG_Node::XPath::Root::xpath_get_parent_node { return } - my $tree=Tree::DAG_Node::XPath->new(); $tree->name('base'); $tree->new_daughter->name("coso$_") for 1..5; diff --git a/t/02-inherit.t b/t/02-inherit.t index fb8e238..e882b53 100644 --- a/t/02-inherit.t +++ b/t/02-inherit.t @@ -1,8 +1,15 @@ #!perl package TransformA;{ - use Tree::Transform::XSLTish; + use Tree::Transform::XSLTish ':engine'; use strict; use warnings; + use Tree::XPathEngine; + use Test::Most; + + engine_factory { + ok 1,'custom factory called'; + Tree::XPathEngine->new(); + }; default_rules; @@ -29,14 +36,11 @@ package TransformB;{ } package main; -use Test::Most qw(no_plan die); +use Test::Most tests=>2,'die'; use strict; use warnings; use Tree::DAG_Node::XPath; -sub Tree::DAG_Node::XPath::Root::xpath_get_root_node { return $_[0] } -sub Tree::DAG_Node::XPath::Root::xpath_get_parent_node { return } - my $tree=Tree::DAG_Node::XPath->new(); $tree->name('base'); $tree->new_daughter->name("coso$_") for 1..5; diff --git a/t/03-byname.t b/t/03-byname.t index 784138b..a16b2d6 100644 --- a/t/03-byname.t +++ b/t/03-byname.t @@ -17,14 +17,11 @@ package NameTransform;{ } package main; -use Test::Most qw(no_plan die); +use Test::Most tests=>1,'die'; use strict; use warnings; use Tree::DAG_Node::XPath; -sub Tree::DAG_Node::XPath::Root::xpath_get_root_node { return $_[0] } -sub Tree::DAG_Node::XPath::Root::xpath_get_parent_node { return } - my $tree=Tree::DAG_Node::XPath->new(); $tree->name('base'); $tree->new_daughter->name("coso$_") for 1..5; diff --git a/t/04-errors.t b/t/04-errors.t index 107c1bd..6656933 100644 --- a/t/04-errors.t +++ b/t/04-errors.t @@ -1,13 +1,10 @@ #!perl package main; -use Test::Most qw(no_plan); +use Test::Most tests=>7; use strict; use warnings; use Tree::DAG_Node::XPath; -sub Tree::DAG_Node::XPath::Root::xpath_get_root_node { return $_[0] } -sub Tree::DAG_Node::XPath::Root::xpath_get_parent_node { return } - my $tree=Tree::DAG_Node::XPath->new(); $tree->name('base'); $tree->new_daughter->name("coso$_") for 1..5; diff --git a/t/05-html-tree.t b/t/05-html-tree.t index eb990e8..2973d25 100644 --- a/t/05-html-tree.t +++ b/t/05-html-tree.t @@ -18,12 +18,10 @@ package main; use Test::Most 'die'; use strict; use warnings; -eval 'use XML::XPathEngine;use HTML::TreeBuilder::XPath;'; -plan skip_all => 'XML::XPathEngine and HTML::TreeBuilder::XPath needed for this test' if $@; +eval 'use XML::XPathEngine;use HTML::TreeBuilder::XPath 0.10;'; +plan skip_all => 'XML::XPathEngine and HTML::TreeBuilder::XPath 0.10 needed for this test' if $@; plan tests=> 1; -sub HTML::TreeBuilder::XPath::Root::getRootNode { return $_[0] } - my $tree=HTML::TreeBuilder::XPath->new(); $tree->parse(<<'HTML');$tree->eof; <html> diff --git a/t/perlcriticrc b/t/perlcriticrc new file mode 100644 index 0000000..8503255 --- /dev/null +++ b/t/perlcriticrc @@ -0,0 +1,122 @@ +severity = 1 +color = 1 +only = 1 + +[BuiltinFunctions::ProhibitBooleanGrep] +[BuiltinFunctions::ProhibitComplexMappings] +[BuiltinFunctions::ProhibitLvalueSubstr] +[BuiltinFunctions::ProhibitReverseSortBlock] +[BuiltinFunctions::ProhibitSleepViaSelect] +[BuiltinFunctions::ProhibitStringyEval] +[BuiltinFunctions::ProhibitStringySplit] +[BuiltinFunctions::ProhibitUniversalCan] +[BuiltinFunctions::ProhibitUniversalIsa] +[BuiltinFunctions::ProhibitVoidGrep] +[BuiltinFunctions::ProhibitVoidMap] +[BuiltinFunctions::RequireBlockGrep] +[BuiltinFunctions::RequireBlockMap] +[BuiltinFunctions::RequireGlobFunction] +[BuiltinFunctions::RequireSimpleSortBlock] +[ClassHierarchies::ProhibitAutoloading] +[ClassHierarchies::ProhibitExplicitISA] +[ClassHierarchies::ProhibitOneArgBless] +[CodeLayout::ProhibitHardTabs] +[CodeLayout::ProhibitParensWithBuiltins] +[CodeLayout::ProhibitQuotedWordLists] +[CodeLayout::ProhibitTrailingWhitespace] +[CodeLayout::RequireConsistentNewlines] +[CodeLayout::RequireTrailingCommas] +[ControlStructures::ProhibitCStyleForLoops] +[ControlStructures::ProhibitCascadingIfElse] +[ControlStructures::ProhibitDeepNests] +[ControlStructures::ProhibitLabelsWithSpecialBlockNames] +[ControlStructures::ProhibitMutatingListFunctions] +[ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions] +[ControlStructures::ProhibitPostfixControls] +[ControlStructures::ProhibitUnreachableCode] +[ControlStructures::ProhibitUntilBlocks] +[Documentation::RequirePackageMatchesPodName] +[Documentation::RequirePodAtEnd] +[ErrorHandling::RequireCarping] +[ErrorHandling::RequireCheckingReturnValueOfEval] +[InputOutput::ProhibitBacktickOperators] +[InputOutput::ProhibitBarewordFileHandles] +[InputOutput::ProhibitExplicitStdin] +[InputOutput::ProhibitInteractiveTest] +[InputOutput::ProhibitJoinedReadline] +[InputOutput::ProhibitOneArgSelect] +[InputOutput::ProhibitReadlineInForLoop] +[InputOutput::ProhibitTwoArgOpen] +[InputOutput::RequireBracedFileHandleWithPrint] +[InputOutput::RequireBriefOpen] +[InputOutput::RequireCheckedClose] +[InputOutput::RequireCheckedOpen] +[InputOutput::RequireCheckedSyscalls] +[Miscellanea::ProhibitFormats] +[Miscellanea::ProhibitTies] +[Miscellanea::ProhibitUnrestrictedNoCritic] +[Miscellanea::ProhibitUselessNoCritic] +[Modules::ProhibitAutomaticExportation] +[Modules::ProhibitExcessMainComplexity] +[Modules::ProhibitMultiplePackages] +[Modules::RequireBarewordIncludes] +[Modules::RequireEndWithOne] +[Modules::RequireExplicitPackage] +[Modules::RequireFilenameMatchesPackage] +[Modules::RequireNoMatchVarsWithUseEnglish] +[Modules::RequireVersionVar] +[NamingConventions::Capitalization] +[NamingConventions::ProhibitAmbiguousNames] +[References::ProhibitDoubleSigils] +[RegularExpressions::ProhibitCaptureWithoutTest] +[RegularExpressions::ProhibitFixedStringMatches] +[RegularExpressions::ProhibitUnusualDelimiters] +[RegularExpressions::RequireBracesForMultiline] +[RegularExpressions::RequireDotMatchAnything] +[RegularExpressions::RequireExtendedFormatting] +[RegularExpressions::RequireLineBoundaryMatching] +[Subroutines::ProhibitAmpersandSigils] +[Subroutines::ProhibitBuiltinHomonyms] +[Subroutines::ProhibitExcessComplexity] +[Subroutines::ProhibitExplicitReturnUndef] +[Subroutines::ProhibitManyArgs] +[Subroutines::ProhibitNestedSubs] +[Subroutines::ProhibitReturnSort] +[Subroutines::RequireFinalReturn] +[TestingAndDebugging::ProhibitNoStrict] +[TestingAndDebugging::ProhibitNoWarnings] +[TestingAndDebugging::ProhibitProlongedStrictureOverride] +[TestingAndDebugging::RequireTestLabels] +[TestingAndDebugging::RequireUseStrict] +[TestingAndDebugging::RequireUseWarnings] +[ValuesAndExpressions::ProhibitCommaSeparatedStatements] +[ValuesAndExpressions::ProhibitConstantPragma] +[ValuesAndExpressions::ProhibitEmptyQuotes] +[ValuesAndExpressions::ProhibitEscapedCharacters] +[ValuesAndExpressions::ProhibitImplicitNewlines] +[ValuesAndExpressions::ProhibitInterpolationOfLiterals] +[ValuesAndExpressions::ProhibitLeadingZeros] +[ValuesAndExpressions::ProhibitLongChainsOfMethodCalls] +[ValuesAndExpressions::ProhibitMagicNumbers] +[ValuesAndExpressions::ProhibitMismatchedOperators] +[ValuesAndExpressions::ProhibitMixedBooleanOperators] +[ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters] +[ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator] +[ValuesAndExpressions::ProhibitVersionStrings] +[ValuesAndExpressions::RequireInterpolationOfMetachars] +[ValuesAndExpressions::RequireNumberSeparators] +[ValuesAndExpressions::RequireQuotedHeredocTerminator] +[ValuesAndExpressions::RequireUpperCaseHeredocTerminator] +[Variables::ProhibitConditionalDeclarations] +[Variables::ProhibitLocalVars] +[Variables::ProhibitMatchVars] +[Variables::ProhibitPackageVars] +[Variables::ProhibitPerl4PackageNames] +[Variables::ProhibitPunctuationVars] +[Variables::ProhibitReusedNames] +[Variables::ProhibitUnusedVariables] +[Variables::ProtectPrivateVars] +[Variables::RequireInitializationForLocalVars] +[Variables::RequireLexicalLoopIterators] +[Variables::RequireLocalizedPunctuationVars] +[Variables::RequireNegativeIndices] |