From d7d10fff41ecbf4c5f43791ae8f22c37804ab88d Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 27 Apr 2009 22:12:42 +0000 Subject: [PATCH] Add a Search test, to check for wildcards and stopwords. --- t/Search.t | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 t/Search.t diff --git a/t/Search.t b/t/Search.t new file mode 100644 index 000000000..daf080c86 --- /dev/null +++ b/t/Search.t @@ -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