From: Dan Brook Date: Sun, 30 Oct 2011 22:22:52 +0000 (+0000) Subject: Use appropriate prototype depending on perl version in test. X-Git-Tag: 0.003007~21^2~1^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FGitalist.git;a=commitdiff_plain;h=8f7296d0b564f052d4b17dddbd553dc355b04f88 Use appropriate prototype depending on perl version in test. The _ prototype didn't exist before-5.10 and since Gitalist runs under 5.8.9 at least it seemed only proper to have this test not blow up horribly. --- diff --git a/t/02git_Repository.t b/t/02git_Repository.t index c8aae14..9565143 100644 --- a/t/02git_Repository.t +++ b/t/02git_Repository.t @@ -13,14 +13,17 @@ use Test::Exception; use Test::utf8; use Encode qw/decode_utf8/; use Data::Dumper; +use Scalar::Util qw/set_prototype/; BEGIN { # Mocking to allow testing regardless of the user's locale require I18N::Langinfo if $^O ne 'MSWin32'; no warnings 'redefine'; - *I18N::Langinfo::langinfo = sub(_) { + my $stub = sub { return "UTF-8" if $_[0] == I18N::Langinfo::CODESET(); }; + set_prototype \&$stub, ($] <= 5.008009) ? '$' : '_'; + *I18N::Langinfo::langinfo = $stub; *CORE::GLOBAL::getpwuid = sub { wantarray ? ("test", "x", "1000", "1000", "", "", "T\x{c3}\x{a9}st", "/home/test", "/bin/bash")