Add a Search test, to check for wildcards and stopwords.

This commit is contained in:
Colin Kuskie 2009-04-27 22:12:42 +00:00
parent c327353213
commit d7d10fff41

51
t/Search.t Normal file
View file

@ -0,0 +1,51 @@
# vim:syntax=perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#------------------------------------------------------------------
# Write a little about what this script tests.
#
#
use FindBin;
use strict;
use lib "$FindBin::Bin/lib";
use Test::More;
use WebGUI::Test; # Must use this before any other WebGUI modules
use WebGUI::Session;
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
plan tests => 6; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
use_ok('WebGUI::Search');
my $search = WebGUI::Search->new($session);
ok(! $search->_isStopword('not a stopword'), '_isStopword: not a stopword');
ok( $search->_isStopword('the'), '_isStopword: "the" is a stopword');
ok( $search->_isStopword('all*'), '_isStopword: regex metacharacter * does not crash the search');
ok( $search->_isStopword('anybody+'), '_isStopword: regex metacharacter + does not crash the search');
ok( $search->_isStopword('maybe?'), '_isStopword: regex metacharacter ? does not crash the search');
#----------------------------------------------------------------------------
# Cleanup
END {
}
#vim:ft=perl