Path: blob/master/src/applications/differential/parser/__tests__/DifferentialCustomFieldRevertsParserTestCase.php
12262 views
<?php12final class DifferentialCustomFieldRevertsParserTestCase3extends PhabricatorTestCase {45public function testParser() {6$map = array(7'quack quack quack' => array(),89// Git default message.10'This reverts commit 1234abcd.' => array(11array(12'match' => 'reverts commit 1234abcd',13'prefix' => 'reverts',14'infix' => 'commit',15'monograms' => array('1234abcd'),16'suffix' => '',17'offset' => 5,18),19),2021// Mercurial default message.22'Backed out changeset 1234abcd.' => array(23array(24'match' => 'Backed out changeset 1234abcd',25'prefix' => 'Backed out',26'infix' => 'changeset',27'monograms' => array('1234abcd'),28'suffix' => '',29'offset' => 0,30),31),3233'this undoes 1234abcd, 5678efab. they were bad' => array(34array(35'match' => 'undoes 1234abcd, 5678efab',36'prefix' => 'undoes',37'infix' => '',38'monograms' => array('1234abcd', '5678efab'),39'suffix' => '',40'offset' => 5,41),42),4344'Reverts 123' => array(45array(46'match' => 'Reverts 123',47'prefix' => 'Reverts',48'infix' => '',49'monograms' => array('123'),50'suffix' => '',51'offset' => 0,52),53),545556'Reverts r123' => array(57array(58'match' => 'Reverts r123',59'prefix' => 'Reverts',60'infix' => '',61'monograms' => array('r123'),62'suffix' => '',63'offset' => 0,64),65),6667"Backs out commit\n99\n100" => array(68array(69'match' => "Backs out commit\n99\n100",70'prefix' => 'Backs out',71'infix' => 'commit',72'monograms' => array('99', '100'),73'suffix' => '',74'offset' => 0,75),76),7778// This tests a degenerate regex behavior, see T9268.79'Reverts aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz' => array(),8081"This doesn't revert anything" => array(),82'nonrevert of r11' => array(),83'fixed a bug' => array(),84);8586foreach ($map as $input => $expect) {87$parser = new DifferentialCustomFieldRevertsParser();88$output = $parser->parseCorpus($input);8990$this->assertEqual($expect, $output, $input);91}92}9394}959697