Tim Starling has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/328122 )
Change subject: FuzzTest: blacklist menu/menuitem as well as isindex ...................................................................... FuzzTest: blacklist menu/menuitem as well as isindex Similar to the reasons for blacklisting the menuitem tests in phpunit: the spec keeps changing. Change-Id: I762824b64a7731910aca77ab350687a0b6ef71e4 --- M src/FuzzTest/FuzzTest.php M src/FuzzTest/TokenSalad.php 2 files changed, 11 insertions(+), 10 deletions(-) Approvals: Tim Starling: Verified; Looks good to me, approved diff --git a/src/FuzzTest/FuzzTest.php b/src/FuzzTest/FuzzTest.php index e0c85bb..99339c2 100644 --- a/src/FuzzTest/FuzzTest.php +++ b/src/FuzzTest/FuzzTest.php @@ -26,11 +26,6 @@ for ( $seed = 0; true; $seed++ ) { mt_srand( $seed ); $text = $tokenSalad->next(); - - if ( stripos( $text, "isindex" ) !== false ) { - // Skip isindex tests - continue; - } if ( @iconv( 'UTF-8', 'UTF-8', $text ) === false ) { // Skip invalid UTF-8 tests continue; diff --git a/src/FuzzTest/TokenSalad.php b/src/FuzzTest/TokenSalad.php index b39fd63..8292a60 100644 --- a/src/FuzzTest/TokenSalad.php +++ b/src/FuzzTest/TokenSalad.php @@ -21,6 +21,8 @@ private $characterSalad; private $entities; + private static $elementNameBlacklist = '/^(menu|isindex)/i'; + public function __construct( $maxLength ) { $this->maxLength = $maxLength; $this->bigDictionary = Utils::getBigDictionary(); @@ -106,15 +108,19 @@ } private function getElementName() { - if ( Utils::coinToss( 0.5 ) ) { + do { if ( Utils::coinToss( 0.5 ) ) { - return Utils::pickRandom( $this->specialTags ); + if ( Utils::coinToss( 0.5 ) ) { + $name = Utils::pickRandom( $this->specialTags ); + } else { + $name = Utils::pickRandom( FuzzData::$w3schoolsTagNames ); + } } else { - return Utils::pickRandom( FuzzData::$w3schoolsTagNames ); + $name = Utils::pickRandom( $this->bigDictionary ); } - } else { - return Utils::pickRandom( $this->bigDictionary ); } + while ( preg_match( self::$elementNameBlacklist, $name ) ); + return $name; } private function getAttributeName() { -- To view, visit https://gerrit.wikimedia.org/r/328122 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I762824b64a7731910aca77ab350687a0b6ef71e4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/libs/RemexHtml Gerrit-Branch: master Gerrit-Owner: Tim Starling <tstarl...@wikimedia.org> Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits