Remove product literal strings in "pht()", part 6
[phabricator.git] / src / applications / project / remarkup / __tests__ / ProjectRemarkupRuleTestCase.php
blob5adbfbfe905d0e70d59bb899dea22474bbd92d65
1 <?php
3 final class ProjectRemarkupRuleTestCase extends PhabricatorTestCase {
5 public function testProjectObjectRemarkup() {
6 $cases = array(
7 'I like #ducks.' => array(
8 'embed' => array(),
9 'ref' => array(
10 array(
11 'offset' => 8,
12 'id' => 'ducks',
16 'We should make a post on #blog.example.com tomorrow.' => array(
17 'embed' => array(),
18 'ref' => array(
19 array(
20 'offset' => 26,
21 'id' => 'blog.example.com',
25 'We should make a post on #blog.example.com.' => array(
26 'embed' => array(),
27 'ref' => array(
28 array(
29 'offset' => 26,
30 'id' => 'blog.example.com',
34 '#123' => array(
35 'embed' => array(),
36 'ref' => array(
37 array(
38 'offset' => 1,
39 'id' => '123',
43 '#2x4' => array(
44 'embed' => array(),
45 'ref' => array(
46 array(
47 'offset' => 1,
48 'id' => '2x4',
52 '#security#123' => array(
53 'embed' => array(),
54 'ref' => array(
55 array(
56 'offset' => 1,
57 'id' => 'security',
58 'tail' => '123',
63 // Don't match a terminal parenthesis. This fixes these constructs in
64 // natural language.
65 'There is some documentation (see #guides).' => array(
66 'embed' => array(),
67 'ref' => array(
68 array(
69 'offset' => 34,
70 'id' => 'guides',
75 // Don't match internal parentheses either. This makes the terminal
76 // parenthesis behavior less arbitrary (otherwise, we match open
77 // parentheses but not closing parentheses, which is surprising).
78 '#a(b)c' => array(
79 'embed' => array(),
80 'ref' => array(
81 array(
82 'offset' => 1,
83 'id' => 'a',
88 '#s3' => array(
89 'embed' => array(),
90 'ref' => array(
91 array(
92 'offset' => 1,
93 'id' => 's3',
98 'Is this #urgent?' => array(
99 'embed' => array(),
100 'ref' => array(
101 array(
102 'offset' => 9,
103 'id' => 'urgent',
108 'This is "#urgent".' => array(
109 'embed' => array(),
110 'ref' => array(
111 array(
112 'offset' => 10,
113 'id' => 'urgent',
118 "This is '#urgent'." => array(
119 'embed' => array(),
120 'ref' => array(
121 array(
122 'offset' => 10,
123 'id' => 'urgent',
128 '**#orbital**' => array(
129 'embed' => array(),
130 'ref' => array(
131 array(
132 'offset' => 3,
133 'id' => 'orbital',
140 foreach ($cases as $input => $expect) {
141 $rule = new ProjectRemarkupRule();
142 $matches = $rule->extractReferences($input);
143 $this->assertEqual($expect, $matches, $input);