Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100921576
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
Mon, Feb 3, 23:36
Size
750 B
Mime Type
text/x-php
Expires
Wed, Feb 5, 23:36 (2 d)
Engine
blob
Format
Raw Data
Handle
24054815
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