[Rt-commit] rt branch, 4.0/decode-entities-before-indexing, updated. rt-4.0.22-22-g7cb37c6

Alex Vandiver alexmv at bestpractical.com
Tue Dec 23 16:15:04 EST 2014


The branch, 4.0/decode-entities-before-indexing has been updated
       via  7cb37c6fc820f279d514dda9285e9aae65296e8b (commit)
      from  9ced88246f8ff368e0877c454fb70b81b654d673 (commit)

Summary of changes:
 lib/RT/Test.pm     |  2 +-
 t/fts/indexed_pg.t | 14 ++++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 7cb37c6fc820f279d514dda9285e9aae65296e8b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Dec 23 16:04:41 2014 -0500

    Add tests for UTF-8 characters

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 104e93a..00ea26d 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -830,7 +830,7 @@ sub create_ticket {
         $args{'MIMEObj'} = MIME::Entity->build(
             From    => Encode::encode( "UTF-8", $args{'Requestor'} ),
             Subject => RT::Interface::Email::EncodeToMIME( String => $args{'Subject'} ),
-            Type    => "text/plain",
+            Type    => $args{ContentType} // "text/plain",
             Charset => "UTF-8",
             Data    => Encode::encode( "UTF-8", $content ),
         );
diff --git a/t/fts/indexed_pg.t b/t/fts/indexed_pg.t
index b8d4b1b..88e35ab 100644
--- a/t/fts/indexed_pg.t
+++ b/t/fts/indexed_pg.t
@@ -9,8 +9,6 @@ my ($major, $minor) = $RT::Handle->dbh->get_info(18) =~ /^0*(\d+)\.0*(\d+)/;
 plan skip_all => "Need Pg 8.2 or higher; we have $major.$minor"
     if "$major.$minor" < 8.2;
 
-plan tests => 36;
-
 RT->Config->Set( FullTextSearch => Enable => 1, Indexed => 1, Column => 'ContentIndex', Table => 'Attachments' );
 
 setup_indexing();
@@ -70,10 +68,11 @@ sub run_test {
     diag "Wrong SQL query for '$query':". $tix->BuildSelectQuery if $error;
 }
 
+my $blase = Encode::decode_utf8("blasé");
 @tickets = RT::Test->create_tickets(
     { Queue => $q->id },
-    { Subject => 'fts test 1', Content => 'book' },
-    { Subject => 'fts test 2', Content => 'bars'  },
+    { Subject => 'fts test 1', Content => "book $blase" },
+    { Subject => 'fts test 2', Content => "bars blasé", ContentType => 'text/html'  },
 );
 sync_index();
 
@@ -84,6 +83,11 @@ run_tests(
     "Content LIKE 'book'" => { $book->id => 1, $bars->id => 0 },
     "Content LIKE 'bars'" => { $book->id => 0, $bars->id => 1 },
 
+    # Unicode searching
+    "Content LIKE '$blase'" => { $book->id => 1, $bars->id => 1 },
+    "Content LIKE 'blase'"  => { $book->id => 0, $bars->id => 0 },
+    "Content LIKE 'blas'"   => { $book->id => 0, $bars->id => 0 },
+
     # make sure that Pg stemming works
     "Content LIKE 'books'" => { $book->id => 1, $bars->id => 0 },
     "Content LIKE 'bar'"   => { $book->id => 0, $bars->id => 1 },
@@ -116,3 +120,5 @@ run_tests(
 );
 
 @tickets = ();
+
+done_testing;

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


More information about the rt-commit mailing list