Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14399745
PhutilXHPASTSyntaxHighlighterTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
PhutilXHPASTSyntaxHighlighterTestCase.php
View Options
<?php
final
class
PhutilXHPASTSyntaxHighlighterTestCase
extends
PhutilTestCase
{
private
function
highlight
(
$source
)
{
$highlighter
=
new
PhutilXHPASTSyntaxHighlighter
();
$future
=
$highlighter
->
getHighlightFuture
(
$source
);
return
$future
->
resolve
();
}
private
function
read
(
$file
)
{
$path
=
dirname
(
__FILE__
).
'/xhpast/'
.
$file
;
return
Filesystem
::
readFile
(
$path
);
}
public
function
testBuiltinClassnames
()
{
$this
->
assertEqual
(
$this
->
read
(
'builtin-classname.expect'
),
(
string
)
$this
->
highlight
(
$this
->
read
(
'builtin-classname.source'
)),
pht
(
'Builtin classnames should not be marked as linkable symbols.'
));
$this
->
assertEqual
(
rtrim
(
$this
->
read
(
'trailing-comment.expect'
)),
(
string
)
$this
->
highlight
(
$this
->
read
(
'trailing-comment.source'
)),
pht
(
'Trailing comments should not be dropped.'
));
$this
->
assertEqual
(
$this
->
read
(
'multiline-token.expect'
),
(
string
)
$this
->
highlight
(
$this
->
read
(
'multiline-token.source'
)),
pht
(
'Multi-line tokens should be split across lines.'
));
$this
->
assertEqual
(
$this
->
read
(
'leading-whitespace.expect'
),
(
string
)
$this
->
highlight
(
$this
->
read
(
'leading-whitespace.source'
)),
pht
(
'Snippets with leading whitespace should be preserved.'
));
$this
->
assertEqual
(
$this
->
read
(
'no-leading-whitespace.expect'
),
(
string
)
$this
->
highlight
(
$this
->
read
(
'no-leading-whitespace.source'
)),
pht
(
'Snippets with no leading whitespace should be preserved.'
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Dec 24, 5:43 PM (1 d, 12 h)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6907946
Default Alt Text
PhutilXHPASTSyntaxHighlighterTestCase.php (1 KB)
Attached To
Mode
rPHU libphutil
Attached
Detach File
Event Timeline
Log In to Comment