[Rt-commit] rt branch, googleish-refactor, updated. rt-3.9.4-452-gaaaa8fe
Ruslan Zakirov
ruz at bestpractical.com
Fri Nov 12 12:52:40 EST 2010
The branch, googleish-refactor has been updated
via aaaa8fe5764afa57982da5ea8cf15a33bcd110f3 (commit)
from a36b63da6e720b46556e3bf7bb207d29f1143e50 (commit)
Summary of changes:
t/web/googleish_search.t | 48 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 47 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit aaaa8fe5764afa57982da5ea8cf15a33bcd110f3
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Nov 12 20:52:26 2010 +0300
more tests for googleish search
diff --git a/t/web/googleish_search.t b/t/web/googleish_search.t
index 3765bd1..0082752 100644
--- a/t/web/googleish_search.t
+++ b/t/web/googleish_search.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use RT::Test tests => 61, config => 'Set( %FullTextSearch, Enable => 1, Indexed => 0 );';
+use RT::Test tests => 77, config => 'Set( %FullTextSearch, Enable => 1, Indexed => 0 );';
my ($baseurl, $m) = RT::Test->started_ok;
my $url = $m->rt_base_url;
@@ -10,6 +10,52 @@ my $queue = RT::Queue->new($RT::SystemUser);
$queue->Create( Name => 'other' );
ok( $queue->id, 'created queue other');
+my $two_words_queue = RT::Test->load_or_create_queue(
+ Name => 'Two Words',
+);
+ok $two_words_queue && $two_words_queue->id, 'loaded or created a queue';
+
+
+diag "just test an API";
+{
+ my $tickets = RT::Tickets->new( RT->SystemUser );
+
+ require RT::Search::Googleish;
+ my $parser = RT::Search::Googleish->new(
+ TicketsObj => $tickets,
+ Argument => '',
+ );
+ is $parser->QueryToSQL("foo"), "( Subject LIKE 'foo' )", "correct parsing";
+ is $parser->QueryToSQL("1"), "( Id = 1 )", "correct parsing";
+ is $parser->QueryToSQL("'1'"), "( Subject LIKE '1' )", "correct parsing";
+
+ is $parser->QueryToSQL("foo bar"),
+ "( Subject LIKE 'foo' AND Subject LIKE 'bar' )",
+ "correct parsing";
+ is $parser->QueryToSQL("'foo bar'"),
+ "( Subject LIKE 'foo bar' )",
+ "correct parsing";
+
+ is $parser->QueryToSQL("'foo \\' bar'"),
+ "( Subject LIKE 'foo \\' bar' )",
+ "correct parsing";
+ is $parser->QueryToSQL('"foo \' bar"'),
+ "( Subject LIKE 'foo \\' bar' )",
+ "correct parsing";
+ is $parser->QueryToSQL('"\f\o\o"'),
+ "( Subject LIKE 'foo' )",
+ "correct parsing";
+
+ is $parser->QueryToSQL("General"), "( Queue = 'General' )", "correct parsing";
+ is $parser->QueryToSQL("'Two Words'"), "( Queue = 'Two Words' )", "correct parsing";
+ is $parser->QueryToSQL("subject:'Two Words'"), "( Subject LIKE 'Two Words' )", "correct parsing";
+
+ is $parser->QueryToSQL("me"), "( Watcher.id = '__CurrentUser__' )", "correct parsing";
+ is $parser->QueryToSQL("'me'"), "( Subject LIKE 'me' )", "correct parsing";
+ is $parser->QueryToSQL("owner:me"), "( Owner.id = '__CurrentUser__' )", "correct parsing";
+ is $parser->QueryToSQL("owner:'me'"), "( Owner = 'me' )", "correct parsing";
+}
+
my $ticket_found_1 = RT::Ticket->new($RT::SystemUser);
my $ticket_found_2 = RT::Ticket->new($RT::SystemUser);
my $ticket_not_found = RT::Ticket->new($RT::SystemUser);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list