Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F79241091
PhabricatorMacroTestCase.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, Aug 25, 10:53
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Aug 27, 10:53 (2 d)
Engine
blob
Format
Raw Data
Handle
20166495
Attached To
rPH Phabricator
PhabricatorMacroTestCase.php
View Options
<?php
final
class
PhabricatorMacroTestCase
extends
PhabricatorTestCase
{
public
function
testMacroNames
()
{
$lit
=
"
\x
F0
\x
9F
\x
94
\x
A5"
;
$combining_diaeresis
=
"
\x
CC
\x
88"
;
$cases
=
array
(
// Only 2 glyphs long.
"u{$combining_diaeresis}n"
=>
false
,
"{$lit}{$lit}"
=>
false
,
// Too short.
'a'
=>
false
,
''
=>
false
,
// Bad characters.
'yes!'
=>
false
,
"{$lit} {$lit} {$lit}"
=>
false
,
"aaa
\n
bbb"
=>
false
,
'aaa~'
=>
false
,
'aaa`'
=>
false
,
// Special rejections for only latin symbols.
'---'
=>
false
,
'___'
=>
false
,
'-_-'
=>
false
,
':::'
=>
false
,
'-_:'
=>
false
,
"{$lit}{$lit}{$lit}"
=>
true
,
'bwahahaha'
=>
true
,
"u{$combining_diaeresis}nt"
=>
true
,
'a-a-a-a'
=>
true
,
);
foreach
(
$cases
as
$input
=>
$expect
)
{
$this
->
assertEqual
(
$expect
,
PhabricatorMacroNameTransaction
::
isValidMacroName
(
$input
),
pht
(
'Validity of macro "%s"'
,
$input
));
}
}
}
Event Timeline
Log In to Comment