Skip to content

Commit 9e04d19

Browse files
committed
Add tests for email reply level situations
1 parent 197b70b commit 9e04d19

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

src/test/java/org/nibor/autolink/AutolinkEmailTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ public void triggerOverlap() {
122122
assertLinked("www@example.com", "|www@example.com|");
123123
}
124124

125+
@Test
126+
public void replyLevel() {
127+
assertLinked(">foo@example.com", ">|foo@example.com|");
128+
assertLinked("> foo@example.com", "> |foo@example.com|");
129+
assertLinked(">>foo@example.com", ">>|foo@example.com|");
130+
assertLinked(">> foo@example.com", ">> |foo@example.com|");
131+
assertLinked("> > foo@example.com", "> > |foo@example.com|");
132+
assertLinked(">>>foo@example.com", ">>>|foo@example.com|");
133+
assertLinked(">>> foo@example.com", ">>> |foo@example.com|");
134+
assertLinked("> > > foo@example.com", "> > > |foo@example.com|");
135+
}
136+
125137
@Override
126138
protected LinkExtractor getLinkExtractor() {
127139
return linkExtractor;

src/test/java/org/nibor/autolink/AutolinkUrlTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,18 @@ public void international() {
184184
assertLinked("http://example.org/\u00A2", "|http://example.org/\u00A2|");
185185
}
186186

187+
@Test
188+
public void replyLevel() {
189+
assertLinked(">http://example.org/", ">|http://example.org/|");
190+
assertLinked("> http://example.org/", "> |http://example.org/|");
191+
assertLinked(">>http://example.org/", ">>|http://example.org/|");
192+
assertLinked(">> http://example.org/", ">> |http://example.org/|");
193+
assertLinked("> > http://example.org/", "> > |http://example.org/|");
194+
assertLinked(">>>http://example.org/", ">>>|http://example.org/|");
195+
assertLinked(">>> http://example.org/", ">>> |http://example.org/|");
196+
assertLinked("> > > http://example.org/", "> > > |http://example.org/|");
197+
}
198+
187199
@Test
188200
public void linkToString() {
189201
Iterable<LinkSpan> links = getLinkExtractor().extractLinks("wow, so example: http://test.com");

src/test/java/org/nibor/autolink/AutolinkWwwTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@ public void international() {
6868
assertLinked("www.example.org/\u00A2", "|www.example.org/\u00A2|");
6969
}
7070

71+
@Test
72+
public void replyLevel() {
73+
assertLinked(">www.example.org/", ">|www.example.org/|");
74+
assertLinked("> www.example.org/", "> |www.example.org/|");
75+
assertLinked(">>www.example.org/", ">>|www.example.org/|");
76+
assertLinked(">> www.example.org/", ">> |www.example.org/|");
77+
assertLinked("> > www.example.org/", "> > |www.example.org/|");
78+
assertLinked(">>>www.example.org/", ">>>|www.example.org/|");
79+
assertLinked(">>> www.example.org/", ">>> |www.example.org/|");
80+
assertLinked("> > > www.example.org/", "> > > |www.example.org/|");
81+
}
82+
7183
@Override
7284
protected LinkExtractor getLinkExtractor() {
7385
return linkExtractor;

0 commit comments

Comments
 (0)