[Rt-commit] rt branch, 4.0/i18n-guess, created. rt-3.9.7-1128-g5dbdd9c

Alex Vandiver alexmv at bestpractical.com
Tue Dec 28 18:50:03 EST 2010


The branch, 4.0/i18n-guess has been created
        at  5dbdd9c34ee95b410531c220d6aca330cde46af3 (commit)

- Log -----------------------------------------------------------------
commit bea527790a00f3f4b1e6fed8e5faaf235e315367
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Dec 28 17:55:29 2010 -0500

    Encode::Guess picks the first of EmailInputEncodings; no need to TODO both tests
    
    Also, add a test for the windows-1251 alias for cp1251

diff --git a/t/api/i18n_guess.t b/t/api/i18n_guess.t
index b07941c..ab8dc89 100644
--- a/t/api/i18n_guess.t
+++ b/t/api/i18n_guess.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 9;
+use RT::Test tests => 13;
 
 use Encode qw(encode);
 
@@ -13,7 +13,7 @@ use constant HAS_ENCODE_DETECT => do { local $@; eval { require Encode::Detect::
 my $string = "\x{442}\x{435}\x{441}\x{442} \x{43f}\x{43e}\x{434}\x{434}\x{435}\x{440}\x{436}\x{43a}\x{430}";
 
 sub guess {
-    is( RT::I18N::_GuessCharset( Encode::encode($_[0], $_[1]) ), $_[0], 'correct guess' );
+    is( RT::I18N::_GuessCharset( Encode::encode($_[0], $_[1]) ), $_[2] || $_[0], 'correct guess' );
 }
 
 RT->Config->Set(EmailInputEncodings => qw(*));
@@ -26,14 +26,24 @@ SKIP: {
 
 RT->Config->Set(EmailInputEncodings => qw(UTF-8 cp1251 koi8-r));
 SKIP: {
+    skip "No Encode::Guess", 4 unless HAS_ENCODE_GUESS;
+    guess('utf-8', $string);
+    guess('cp1251', $string);
+    guess('windows-1251', $string, 'cp1251');
+    {
+        local $TODO = "Encode::Guess can't distinguish cp1251 from koi8-r";
+        guess('koi8-r', $string);
+    }
+}
+
+RT->Config->Set(EmailInputEncodings => qw(UTF-8 koi8-r cp1251));
+SKIP: {
     skip "No Encode::Guess", 3 unless HAS_ENCODE_GUESS;
     guess('utf-8', $string);
+    guess('koi8-r', $string);
     {
-        local $TODO = 'Encode::Guess can not distinguish cp1251 from koi8-r';
-        # we can not todo one test here as it's depends on hash order and
-        # varies from system to system
+        local $TODO = "Encode::Guess can't distinguish cp1251 from koi8-r";
         guess('cp1251', $string);
-        guess('koi8-r', $string);
     }
 }
 

commit 5dbdd9c34ee95b410531c220d6aca330cde46af3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Dec 28 18:49:15 2010 -0500

    Make test message more explicit

diff --git a/t/api/i18n_guess.t b/t/api/i18n_guess.t
index ab8dc89..88e48e6 100644
--- a/t/api/i18n_guess.t
+++ b/t/api/i18n_guess.t
@@ -13,7 +13,7 @@ use constant HAS_ENCODE_DETECT => do { local $@; eval { require Encode::Detect::
 my $string = "\x{442}\x{435}\x{441}\x{442} \x{43f}\x{43e}\x{434}\x{434}\x{435}\x{440}\x{436}\x{43a}\x{430}";
 
 sub guess {
-    is( RT::I18N::_GuessCharset( Encode::encode($_[0], $_[1]) ), $_[2] || $_[0], 'correct guess' );
+    is( RT::I18N::_GuessCharset( Encode::encode($_[0], $_[1]) ), $_[2] || $_[0], "$_[0] guesses as @{[$_[2]||$_[0]]}" );
 }
 
 RT->Config->Set(EmailInputEncodings => qw(*));

-----------------------------------------------------------------------


More information about the Rt-commit mailing list