Index: modules/search/search.test =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.test,v retrieving revision 1.2 diff -u -F^function -r1.2 search.test --- modules/search/search.test 14 May 2008 11:10:52 -0000 1.2 +++ modules/search/search.test 17 May 2008 20:29:14 -0000 @@ -248,3 +248,57 @@ } } } + +class SearchSimplifyTestCase extends DrupalWebTestCase { + /** + * Implementation of getInfo(). + */ + function getInfo() { + return array( + 'name' => t('Text processing'), + 'description' => t('Tests the test processing done by search_simplify.'), + 'group' => t('Search'), + ); + } + + /** + * Implementation setUp(). + */ + function setUp() { + parent::setUp('search'); + } + + /** + * Test that different strings are simplified as expected in the search_simplify function + */ + function testSearchSimplify() { + $strings = array( + // String to lowercase. + 'String LOWERCASE tEst' => 'string lowercase test', + // Numeric joins after punctuation character removal. + '10-10-2008' => '10102008', + '10/11/2008' => '10112008', + '10.12.2008' => '10122008', + // String concatenation after punctuation character removal. + 'sentence end.no space' => 'sentence endno space', + 'piped|chars' => 'piped chars', + 'www.drupal.org' => 'wwwdrupalorg', + 'low-cost' => 'lowcost', + 'A.C.M.E.' => 'acme', + // Spaces inserted for punctuations. + 'sentence. end' => 'sentence end', + '{curly braces}' => ' curly braces ', + 'exclamation!!!' => 'exclamation ', + 'function_name()' => 'functionname ', + '~special quotes~' => ' special quotes ', + // CJK Handler. + '豈' => ' 豈 ', + '龜' => ' 龜 ', + '㐀' => ' 㐀 ', + ); + + foreach ($strings as $initial => $expected) { + $this->assertEqual($expected, search_simplify($initial), t('String "!initial" becomes "!simplified", expected "!expected".', array('!initial' => $initial, '!simplified' => search_simplify($initial), '!expected' => $expected))); + } + } +}