Test Coverage for search_simplify

BlakeLucchesi - May 10, 2008 - 21:33
Project:Drupal
Version:7.x-dev
Component:search.module
Category:task
Priority:normal
Assigned:Unassigned
Status:needs work
Description

This patch provides a new class for test coverage of the search_simplify function which processes text before it is inserted into the index and before it is used for searching in do_search().

AttachmentSizeStatusTest resultOperations
search_simplify_test.patch1.97 KBIgnoredNoneNone

#1

BlakeLucchesi - May 10, 2008 - 22:04

Rerolled with notes as to which test case covers which part of search_simplify and adds CJK tests.

AttachmentSizeStatusTest resultOperations
search_simplify_test.patch2.39 KBIgnoredNoneNone

#2

libsys - May 10, 2008 - 22:08

Reviewed, looks good to me.

#3

dmitrig01 - May 11, 2008 - 01:35
Status:needs review» needs work

<?php
+       '10102008' => '10-10-2008',
+      
'10102008' => '10/10/2008',
+      
'10102008' => '10.10.2008',
?>

This won't work. array keys are unique.

Try reversing the array.

#4

BlakeLucchesi - May 11, 2008 - 14:33

Must have been tired. Thanks. Rerolled.

AttachmentSizeStatusTest resultOperations
search_simplify_test.patch2.39 KBIgnoredNoneNone

#5

douggreen - May 12, 2008 - 02:07

So that we don't run into more cases in the future like dmitrig01 found, I'd switch the key and value in the array so that it's initial => expected.

#6

dmitrig01 - May 16, 2008 - 04:45

Agreed.

#7

David Lesieur - May 17, 2008 - 20:33

Re-rolled, switching array to initial => expected.

AttachmentSizeStatusTest resultOperations
257033_search_simplify.patch2.12 KBIgnoredNoneNone

#8

David Lesieur - May 17, 2008 - 20:35
Status:needs work» needs review

#9

douggreen - May 20, 2008 - 12:12

Be careful when you apply this patch to make sure that you don't lose the multibyte characters. I first applied it by copying the patch from my web browser (which is what I always do), and it failed the three CJK tests. However after downloading the patch using wget, it applied and passed all tests.

I also reviewed the code, and think that it's mostly ready to go. I'm one of the worst when it comes to commenting, so I'm not exactly sure what our standard is. But if I would add anything, it's that your comments aren't fully sentences and probably should be. You might get asked to change comments like "String to lowercase." to full sentences such as "Test simplification of strings to lowercase characters."

#10

douggreen - May 20, 2008 - 12:41
Title:Test Coverage for search_simplify();» Test Coverage for search_simplify

#11

catch - July 25, 2008 - 14:39
Category:feature request» task
Status:needs review» needs work

The patch applies fine and the tests run OK, but Doug's right on the comments, they need fleshing out to full sentences.

 
 

Drupal is a registered trademark of Dries Buytaert.