.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Test::Requires::Git 3pm" .TH Test::Requires::Git 3pm "2016-12-04" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Test::Requires::Git \- Check your test requirements against the available version of Git .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # will skip all if git is not available \& use Test::Requires::Git; \& \& # needs some git that supports \`git init $dir\` \& test_requires_git version_ge => \*(Aq1.6.5\*(Aq; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Test::Requires::Git checks if the version of Git available for testing meets the given requirements. If the checks fail, then all tests will be \fIskipped\fR. .PP \&\f(CW\*(C`use Test::Requires::Git\*(C'\fR always calls \f(CW\*(C`test_requires_git\*(C'\fR with the given arguments. If you don't want \f(CW\*(C`test_requires_git\*(C'\fR to be called at import time, write this instead: .PP .Vb 1 \& use Test::Requires::Git \-nocheck; .Ve .PP Passing the \f(CW\*(C`git\*(C'\fR parameter (see \*(L"test_requires_git\*(R" below) to \&\f(CW\*(C`use Test::Requires::Git\*(C'\fR will override it for the rest of the program run. .SH "EXPORTED FUNCTIONS" .IX Header "EXPORTED FUNCTIONS" .SS "test_requires_git" .IX Subsection "test_requires_git" .Vb 2 \& # skip all unless git is available as required \& test_requires_git version_ge => \*(Aq1.6.5\*(Aq; \& \& # giving no operator implies \*(Aqversion_ge\*(Aq \& test_requires_git \*(Aq1.6.5\*(Aq; \& \& # skip 2 if git is not available \& SKIP: { \& test_requires_git skip => 2; \& ...; \& } \& \& # skip 2 unless git is available as required \& SKIP: { \& test_requires_git \& skip => 2, \& version_ge => \*(Aq1.7.12\*(Aq; \& ...; \& } \& \& # skip all remaining tests if git is not available \& test_requires_git; \& \& # force which git binary to use \& test_requires_git \& git => \*(Aq/usr/local/bin/git\*(Aq, \& version_ge => \*(Aq1.6.5\*(Aq; .Ve .PP Takes a list of version requirements (see \*(L"\s-1GIT VERSION CHECKING\*(R"\s0 below), and if one of them does not pass, \fIskips\fR all remaining tests. All conditions must be satisfied for the check to pass. .PP When the \f(CW\*(C`skip\*(C'\fR parameter is given, only the specified number of tests will be skipped. .PP The \*(L"current git\*(R" is obtained by running \f(CW\*(C`git \-\-version\*(C'\fR. I.e. the first \f(CW\*(C`git\*(C'\fR binary found in the current environment will be tested. This is of course sensitive to local changes to \f(CW\*(C`PATH\*(C'\fR, so this will behave as expected: .PP .Vb 6 \& # skip 4 tests if there\*(Aqs no git available in the alternative PATH \& SKIP: { \& local $ENV{PATH} = $alternative_PATH; \& test_requires_git skip => 4; \& ...; \& } .Ve .PP When the \f(CW\*(C`git\*(C'\fR parameter is given, \f(CW\*(C`test_requires_git\*(C'\fR will run that program instead of \f(CW\*(C`git\*(C'\fR. .PP If no condition is given, \f(CW\*(C`test_requires_git\*(C'\fR will simply check if \f(CW\*(C`git\*(C'\fR is available. .PP The first time it's called, \f(CW\*(C`test_require_git\*(C'\fR will print a test diagnostic with the output of \f(CW\*(C`git \-\-version\*(C'\fR (if \f(CW\*(C`git\*(C'\fR is available, of course). To prevent this behaviour, load the module with: .PP .Vb 1 \& use Test::Requires::Git \-quiet; .Ve .SH "GIT VERSION CHECKING" .IX Header "GIT VERSION CHECKING" The actual comparison is handled by Git::Version::Compare, so the strings can be version numbers, tags from \f(CW\*(C`git.git\*(C'\fR or the output of \&\f(CW\*(C`git version\*(C'\fR or \f(CW\*(C`git describe\*(C'\fR. .PP The following version checks are currently supported: .SS "version_eq" .IX Subsection "version_eq" Aliases: \f(CW\*(C`version_eq\*(C'\fR, \f(CW\*(C`eq\*(C'\fR, \f(CW\*(C`==\*(C'\fR, \f(CW\*(C`version\*(C'\fR. .PP .Vb 1 \& test_requires_git version_eq => $version; .Ve .PP Passes if the current \fBgit\fR version is \fIequal\fR to \f(CW$version\fR. .SS "version_ne" .IX Subsection "version_ne" Aliases: \f(CW\*(C`version_ne\*(C'\fR, \f(CW\*(C`ne\*(C'\fR, \f(CW\*(C`!=\*(C'\fR. .PP .Vb 1 \& test_requires_git version_eq => $version; .Ve .PP Passes if the current \fBgit\fR version is \fInot equal\fR to \f(CW$version\fR. .SS "version_lt" .IX Subsection "version_lt" Aliases: \f(CW\*(C`version_lt\*(C'\fR, \f(CW\*(C`lt\*(C'\fR, \f(CW\*(C`<\*(C'\fR. .PP .Vb 1 \& test_requires_git version_lt => $version; .Ve .PP Passes if the current \fBgit\fR version is \fIless than\fR \f(CW$version\fR. .SS "version_gt" .IX Subsection "version_gt" Aliases: \f(CW\*(C`version_gt\*(C'\fR, \f(CW\*(C`gt\*(C'\fR, \f(CW\*(C`>\*(C'\fR. .PP .Vb 1 \& test_requires_git version_gt => $version; .Ve .PP Passes if the current \fBgit\fR version is \fIgreater than\fR \f(CW$version\fR. .SS "version_le" .IX Subsection "version_le" Aliases: \f(CW\*(C`version_le\*(C'\fR, \f(CW\*(C`le\*(C'\fR, \f(CW\*(C`<=\*(C'\fR. .PP .Vb 1 \& test_requires_git version_le => $version; .Ve .PP Passes if the current \fBgit\fR version is \fIless than or equal\fR \f(CW$version\fR. .SS "version_ge" .IX Subsection "version_ge" Aliases: \f(CW\*(C`version_ge\*(C'\fR, \f(CW\*(C`ge\*(C'\fR, \f(CW\*(C`>=\*(C'\fR. .PP .Vb 1 \& test_requires_git version_ge => $version; .Ve .PP Passes if the current \fBgit\fR version is \fIgreater than or equal \fR \f(CW$version\fR. .PP As a special shortcut for the most common case, a lone version number is turned into a \f(CW\*(C`version_ge\*(C'\fR check, so the following two lines are exactly equivalent: .PP .Vb 1 \& test_requires_git version_ge => \*(Aq1.6.5\*(Aq; \& \& # version_ge implied \& test_requires_git \*(Aq1.6.5\*(Aq; .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Test::Requires, Git::Version::Compare. .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" Thanks to Oliver Mengué (\s-1DOLMEN\s0), who gave me the idea for this module at the Perl \s-1QA\s0 Hackathon 2015 in Berlin, and suggested to give a look at Test::Requires for inspiration. .SH "AUTHOR" .IX Header "AUTHOR" Philippe Bruhat (BooK), . .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2015\-2016 Philippe Bruhat (BooK), all rights reserved. .SH "LICENSE" .IX Header "LICENSE" This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.