Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97583746
PhutilSimpleOptionsLexerTestCase.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, Jan 5, 11:30
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 11:30 (2 d)
Engine
blob
Format
Raw Data
Handle
23430971
Attached To
rPHU libphutil
PhutilSimpleOptionsLexerTestCase.php
View Options
<?php
final
class
PhutilSimpleOptionsLexerTestCase
extends
PhutilTestCase
{
public
function
testSimpleOptionsLexerTokens
()
{
$this
->
assertEqual
(
array
(
array
(
'word'
,
'legs'
,
null
),
array
(
'='
,
'='
,
null
),
array
(
'word'
,
'4'
,
null
),
),
$this
->
getTokens
(
'legs=4'
));
$this
->
assertEqual
(
array
(
array
(
'word'
,
'legs'
,
null
),
array
(
'='
,
'='
,
null
),
array
(
'word'
,
'4'
,
null
),
array
(
','
,
','
,
null
),
array
(
' '
,
' '
,
null
),
array
(
'word'
,
'LEGS'
,
null
),
array
(
'='
,
'='
,
null
),
array
(
'word'
,
'4'
,
null
),
),
$this
->
getTokens
(
'legs=4, LEGS=4'
));
}
public
function
testSimpleOptionsLexerNiceTokens
()
{
$this
->
assertEqual
(
array
(
array
(
'word'
,
'legs'
,
null
),
),
$this
->
getNiceTokens
(
' legs '
));
$this
->
assertEqual
(
array
(
array
(
'word'
,
'a'
,
null
),
array
(
'word'
,
' '
,
null
),
array
(
'word'
,
'b'
,
null
),
),
$this
->
getNiceTokens
(
' a b '
));
$this
->
assertEqual
(
array
(
array
(
'word'
,
'a'
,
null
),
array
(
'word'
,
'b'
,
null
),
),
$this
->
getNiceTokens
(
'"a""b"'
));
}
private
function
getTokens
(
$input
)
{
$lexer
=
new
PhutilSimpleOptionsLexer
();
return
$lexer
->
getTokens
(
$input
);
}
private
function
getNiceTokens
(
$input
)
{
$lexer
=
new
PhutilSimpleOptionsLexer
();
return
$lexer
->
getNiceTokens
(
$input
);
}
}
Event Timeline
Log In to Comment