Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97235916
DifferentialChangesetParserTestCase.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
Fri, Jan 3, 16:40
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Jan 5, 16:40 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23255681
Attached To
rPH Phabricator
DifferentialChangesetParserTestCase.php
View Options
<?php
final
class
DifferentialChangesetParserTestCase
extends
PhabricatorTestCase
{
public
function
testDiffChangesets
()
{
$hunk
=
new
DifferentialHunk
();
$hunk
->
setChanges
(
"+a
\n
b
\n
-c"
);
$hunk
->
setNewOffset
(
1
);
$hunk
->
setNewLen
(
2
);
$left
=
new
DifferentialChangeset
();
$left
->
attachHunks
(
array
(
$hunk
));
$tests
=
array
(
"+a
\n
b
\n
-c"
=>
array
(
array
(),
array
()),
"+a
\n
x
\n
-c"
=>
array
(
array
(),
array
()),
"+aa
\n
b
\n
-c"
=>
array
(
array
(
1
),
array
(
11
)),
" b
\n
-c"
=>
array
(
array
(
1
),
array
()),
"+a
\n
b
\n
c"
=>
array
(
array
(),
array
(
13
)),
"+a
\n
x
\n
c"
=>
array
(
array
(),
array
(
13
)),
);
foreach
(
$tests
as
$changes
=>
$expected
)
{
$hunk
=
new
DifferentialHunk
();
$hunk
->
setChanges
(
$changes
);
$hunk
->
setNewOffset
(
11
);
$hunk
->
setNewLen
(
3
);
$right
=
new
DifferentialChangeset
();
$right
->
attachHunks
(
array
(
$hunk
));
$parser
=
new
DifferentialChangesetParser
();
$parser
->
setOriginals
(
$left
,
$right
);
$this
->
assertEqual
(
$expected
,
$parser
->
diffOriginals
(),
$changes
);
}
}
}
Event Timeline
Log In to Comment