Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95205264
PhutilPygmentizeParserTestCase.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, Dec 13, 17:32
Size
1003 B
Mime Type
text/x-php
Expires
Sun, Dec 15, 17:32 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22949566
Attached To
rPHU libphutil
PhutilPygmentizeParserTestCase.php
View Options
<?php
final
class
PhutilPygmentizeParserTestCase
extends
PhutilTestCase
{
public
function
testPygmentizeParser
()
{
$this
->
tryParser
(
''
,
''
,
array
(),
pht
(
'Empty'
));
$this
->
tryParser
(
'<span class="mi">1</span>'
,
'<span style="color: #ff0000">1</span>'
,
array
(
'mi'
=>
'color: #ff0000'
,
),
pht
(
'Simple'
));
$this
->
tryParser
(
'<span class="mi">1</span>'
,
'<span class="mi">1</span>'
,
array
(),
pht
(
'Missing Class'
));
$this
->
tryParser
(
'<span data-symbol-name="X" class="nc">X</span>'
,
'<span data-symbol-name="X" style="color: #ff0000">X</span>'
,
array
(
'nc'
=>
'color: #ff0000'
,
),
pht
(
'Extra Attribute'
));
}
private
function
tryParser
(
$input
,
$expect
,
array
$map
,
$label
)
{
$actual
=
id
(
new
PhutilPygmentizeParser
())
->
setMap
(
$map
)
->
parse
(
$input
);
$this
->
assertEqual
(
$expect
,
$actual
,
pht
(
'Pygmentize Parser: %s'
,
$label
));
}
}
Event Timeline
Log In to Comment