X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fversion.t;h=bb5a8f8eaa993cfe0ad757f3ecc9a3f0dd4f822c;hb=9b5be9b5aa498a302ab752a0d1cdb335a620ede2;hp=cc2fde700df20f17a28cbd2925f1b14a8c8840f7;hpb=317f7c8a941b7bf35ae65f6c2b1ed46e040c4441;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/version.t b/lib/version.t index cc2fde7..bb5a8f8 100644 --- a/lib/version.t +++ b/lib/version.t @@ -319,12 +319,15 @@ SKIP: { like($@, qr/Test::More version $version/, 'Replacement eval works with incremented version'); - $version =~ s/\.0$//; #convert to string and remove trailing '.0' - chop($version); # shorten by 1 digit, should still succeed - eval "use Test::More $version"; - unlike($@, qr/Test::More version $version/, + TODO: { + local $TODO = "Test fails with Test::More versions ending in _0X"; + $version =~ s/\.0$//; #convert to string and remove trailing '.0' + chop($version); # shorten by 1 digit, should still succeed + eval "use Test::More $version"; + unlike($@, qr/Test::More version $version/, 'Replacement eval works with single digit'); - + } + $version += 0.1; # this would fail with old UNIVERSAL::VERSION eval "use Test::More $version"; like($@, qr/Test::More version $version/, @@ -455,8 +458,10 @@ EOF like ($@, qr/^www version 1.000 \(v1.0.0\) required/, "Comparing vs. version with decimal only"); - skip 'Cannot "use" extended versions with Perl < 5.6.2', 1 - if $] < 5.006_002; + if ( $] < 5.006_002 ) { + unlink 'www.pm'; + skip 'Cannot "use" extended versions with Perl < 5.6.2', 3; + } eval "use lib '.'; use www 0.0.8;"; like ($@, qr/^www version 0.000008 \(v0.0.8\) required/, "Make sure very small versions don't freak"); @@ -483,6 +488,198 @@ EOF ok(defined(&{"main\::qv"}), "make sure we exported qv() properly"); isa_ok( qv(1.2), "vvv"); unlink 'vvv.pm'; + +SKIP: { + # test locale handling + my $ver = 1.23; # has to be floating point number + my $loc; + while () { + chomp; + $loc = POSIX::setlocale( &POSIX::LC_ALL, $_); + last if POSIX::localeconv()->{decimal_point} eq ','; + } + skip 'Cannot test locale handling without a comma locale', 4 + unless ( $loc and ($ver eq '1,23') ); + + diag ("Testing locale handling with $loc") if $Verbose; + + my $v = $CLASS->new($ver); + unlike($warning,qr/Version string '1,23' contains invalid data/, + "Process locale-dependent floating point"); + is ($v, "1.230", "Locale doesn't apply to version objects"); + ok ($v == $ver, "Comparison to locale floating point"); + } } 1; + +__DATA__ +af_ZA +af_ZA.utf8 +an_ES +an_ES.utf8 +az_AZ.utf8 +be_BY +be_BY.utf8 +bg_BG +bg_BG.utf8 +br_FR +br_FR@euro +br_FR.utf8 +bs_BA +bs_BA.utf8 +ca_ES +ca_ES@euro +ca_ES.utf8 +cs_CZ +cs_CZ.utf8 +da_DK +da_DK.utf8 +de_AT +de_AT@euro +de_AT.utf8 +de_BE +de_BE@euro +de_BE.utf8 +de_DE +de_DE@euro +de_DE.utf8 +de_LU +de_LU@euro +de_LU.utf8 +el_GR +el_GR.utf8 +en_DK +en_DK.utf8 +es_AR +es_AR.utf8 +es_BO +es_BO.utf8 +es_CL +es_CL.utf8 +es_CO +es_CO.utf8 +es_EC +es_EC.utf8 +es_ES +es_ES@euro +es_ES.utf8 +es_PY +es_PY.utf8 +es_UY +es_UY.utf8 +es_VE +es_VE.utf8 +et_EE +et_EE.iso885915 +et_EE.utf8 +eu_ES +eu_ES@euro +eu_ES.utf8 +fi_FI +fi_FI@euro +fi_FI.utf8 +fo_FO +fo_FO.utf8 +fr_BE +fr_BE@euro +fr_BE.utf8 +fr_CA +fr_CA.utf8 +fr_CH +fr_CH.utf8 +fr_FR +fr_FR@euro +fr_FR.utf8 +fr_LU +fr_LU@euro +fr_LU.utf8 +gl_ES +gl_ES@euro +gl_ES.utf8 +hr_HR +hr_HR.utf8 +hu_HU +hu_HU.utf8 +id_ID +id_ID.utf8 +is_IS +is_IS.utf8 +it_CH +it_CH.utf8 +it_IT +it_IT@euro +it_IT.utf8 +ka_GE +ka_GE.utf8 +kk_KZ +kk_KZ.utf8 +kl_GL +kl_GL.utf8 +lt_LT +lt_LT.utf8 +lv_LV +lv_LV.utf8 +mk_MK +mk_MK.utf8 +mn_MN +mn_MN.utf8 +nb_NO +nb_NO.utf8 +nl_BE +nl_BE@euro +nl_BE.utf8 +nl_NL +nl_NL@euro +nl_NL.utf8 +nn_NO +nn_NO.utf8 +no_NO +no_NO.utf8 +oc_FR +oc_FR.utf8 +pl_PL +pl_PL.utf8 +pt_BR +pt_BR.utf8 +pt_PT +pt_PT@euro +pt_PT.utf8 +ro_RO +ro_RO.utf8 +ru_RU +ru_RU.koi8r +ru_RU.utf8 +ru_UA +ru_UA.utf8 +se_NO +se_NO.utf8 +sh_YU +sh_YU.utf8 +sk_SK +sk_SK.utf8 +sl_SI +sl_SI.utf8 +sq_AL +sq_AL.utf8 +sr_CS +sr_CS.utf8 +sv_FI +sv_FI@euro +sv_FI.utf8 +sv_SE +sv_SE.iso885915 +sv_SE.utf8 +tg_TJ +tg_TJ.utf8 +tr_TR +tr_TR.utf8 +tt_RU.utf8 +uk_UA +uk_UA.utf8 +vi_VN +vi_VN.tcvn +wa_BE +wa_BE@euro +wa_BE.utf8 +