From search.test:
<?php
function testSearchResultsComment() {
$comment_body = $this->randomName(5);
// Allow anonymous users to search content.
$edit = array(
DRUPAL_ANONYMOUS_RID . '[search content]'=> 1,
// @todo Comments are added to search index without checking first whether
// anonymous users are allowed to access comments.
DRUPAL_ANONYMOUS_RID . '[access comments]'=> 1,
// @todo Without this permission, "Login or register to post comments" is
// added to the search index. Comment.module is not guilty; that text
// seems to be added via node links.
DRUPAL_ANONYMOUS_RID . '[post comments]'=> 1,
);
$this->drupalPost('admin/config/people/permissions', $edit, t('Save permissions'));
?>