Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102043348
PhutilJSONFragmentLexerHighlighterTestCase.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, Feb 16, 13:01
Size
750 B
Mime Type
text/x-php
Expires
Tue, Feb 18, 13:01 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24269332
Attached To
rPHU libphutil
PhutilJSONFragmentLexerHighlighterTestCase.php
View Options
<?php
final
class
PhutilJSONFragmentLexerHighlighterTestCase
extends
PhutilTestCase
{
public
function
testLexer
()
{
$highlighter
=
id
(
new
PhutilLexerSyntaxHighlighter
())
->
setConfig
(
'language'
,
'json'
)
->
setConfig
(
'lexer'
,
new
PhutilJSONFragmentLexer
());
$path
=
dirname
(
__FILE__
).
'/data/jsonfragment/'
;
foreach
(
Filesystem
::
listDirectory
(
$path
,
$include_hidden
=
false
)
as
$f
)
{
if
(
preg_match
(
'/.test$/'
,
$f
))
{
$expect
=
preg_replace
(
'/.test$/'
,
'.expect'
,
$f
);
$source
=
Filesystem
::
readFile
(
$path
.
'/'
.
$f
);
$this
->
assertEqual
(
Filesystem
::
readFile
(
$path
.
'/'
.
$expect
),
(
string
)
$highlighter
->
getHighlightFuture
(
$source
)->
resolve
(),
$f
);
}
}
}
}
Event Timeline
Log In to Comment