Index: modules/search/search.test =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.test,v retrieving revision 1.1 diff -p -F^f -r1.1 search.test *** modules/search/search.test 20 Apr 2008 18:23:29 -0000 1.1 --- modules/search/search.test 11 May 2008 14:32:51 -0000 *************** class SearchMatchTestCase extends Drupal *** 160,162 **** --- 160,216 ---- $this->assertEqual(!count($scores) || (min($scores) > 0.0 && max($scores) <= 1.0001), TRUE, "Query scoring '$query'"); } } + + 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. + '10102008' => '10-10-2008', + '10112008' => '10/11/2008', + '10122008' => '10.12.2008', + // String concatenation after punctuation character removal. + 'sentence endno space' => 'sentence end.no space', + 'piped chars' => 'piped|chars', + 'wwwdrupalorg' => 'www.drupal.org', + 'lowcost' => 'low-cost', + 'acme' => 'A.C.M.E.', + // Spaces inserted for punctuations. + 'sentence end' => 'sentence. end', + ' curly braces ' => '{curly braces}', + 'exclamation ' => 'exclamation!!!', + 'functionname ' => 'function_name()', + ' special quotes ' => '“special quotes”', + // CJK Handler. + ' 豈 ' => '豈', + ' 龜 ' => '龜', + ' 㐀 ' => '㐀', + ); + + foreach ($strings as $expected => $initial) { + $this->assertEqual($expected, search_simplify($initial), t("String \"!initial\" becomes \"!simplified\", expected \"!expected\".", array('!initial' => $initial, '!simplified' => search_simplify($initial), '!expected' => $expected))); + } + } + } \ No newline at end of file