Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97569990
DifferentialCustomFieldRevertsParserTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jan 5, 09:04
Size
2 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 09:04 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23428599
Attached To
rPH Phabricator
DifferentialCustomFieldRevertsParserTestCase.php
View Options
<?php
final
class
DifferentialCustomFieldRevertsParserTestCase
extends
PhabricatorTestCase
{
public
function
testParser
()
{
$map
=
array
(
'quack quack quack'
=>
array
(),
// Git default message.
'This reverts commit 1234abcd.'
=>
array
(
array
(
'match'
=>
'reverts commit 1234abcd'
,
'prefix'
=>
'reverts'
,
'infix'
=>
'commit'
,
'monograms'
=>
array
(
'1234abcd'
),
'suffix'
=>
''
,
'offset'
=>
5
,
),
),
// Mercurial default message.
'Backed out changeset 1234abcd.'
=>
array
(
array
(
'match'
=>
'Backed out changeset 1234abcd'
,
'prefix'
=>
'Backed out'
,
'infix'
=>
'changeset'
,
'monograms'
=>
array
(
'1234abcd'
),
'suffix'
=>
''
,
'offset'
=>
0
,
),
),
'this undoes 1234abcd, 5678efab. they were bad'
=>
array
(
array
(
'match'
=>
'undoes 1234abcd, 5678efab'
,
'prefix'
=>
'undoes'
,
'infix'
=>
''
,
'monograms'
=>
array
(
'1234abcd'
,
'5678efab'
),
'suffix'
=>
''
,
'offset'
=>
5
,
),
),
'Reverts 123'
=>
array
(
array
(
'match'
=>
'Reverts 123'
,
'prefix'
=>
'Reverts'
,
'infix'
=>
''
,
'monograms'
=>
array
(
'123'
),
'suffix'
=>
''
,
'offset'
=>
0
,
),
),
'Reverts r123'
=>
array
(
array
(
'match'
=>
'Reverts r123'
,
'prefix'
=>
'Reverts'
,
'infix'
=>
''
,
'monograms'
=>
array
(
'r123'
),
'suffix'
=>
''
,
'offset'
=>
0
,
),
),
"Backs out commit
\n
99
\n
100"
=>
array
(
array
(
'match'
=>
"Backs out commit
\n
99
\n
100"
,
'prefix'
=>
'Backs out'
,
'infix'
=>
'commit'
,
'monograms'
=>
array
(
'99'
,
'100'
),
'suffix'
=>
''
,
'offset'
=>
0
,
),
),
"This doesn't revert anything"
=>
array
(),
'nonrevert of r11'
=>
array
(),
'fixed a bug'
=>
array
(),
);
foreach
(
$map
as
$input
=>
$expect
)
{
$parser
=
new
DifferentialCustomFieldRevertsParser
();
$output
=
$parser
->
parseCorpus
(
$input
);
$this
->
assertEqual
(
$expect
,
$output
,
$input
);
}
}
}
Event Timeline
Log In to Comment