Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2008-08-15 15:50:59 -0400
committerspingel2008-08-15 15:50:59 -0400
commit4ee54166e8ef750bcf05e0425500bf4299c8149a (patch)
treedfbb91ab80704cd1d02b2058738dc6bc51d3eacd /org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/internal/trac/ui
parentf7a0decd17827c154cfddf9936bd863f681dffbc (diff)
downloadorg.eclipse.mylyn.tasks-4ee54166e8ef750bcf05e0425500bf4299c8149a.tar.gz
org.eclipse.mylyn.tasks-4ee54166e8ef750bcf05e0425500bf4299c8149a.tar.xz
org.eclipse.mylyn.tasks-4ee54166e8ef750bcf05e0425500bf4299c8149a.zip
NEW - bug 244017: Hyperlinking support for Trac should handle disabled (escaped) links.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=244017
Diffstat (limited to 'org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/internal/trac/ui')
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtilStandaloneTest.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtilStandaloneTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtilStandaloneTest.java
new file mode 100644
index 000000000..5da93d304
--- /dev/null
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtilStandaloneTest.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Mylyn project committers and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.trac.ui;
+
+import java.util.regex.Matcher;
+
+import junit.framework.TestCase;
+
+/**
+ * @author David Green
+ */
+public class TracHyperlinkUtilStandaloneTest extends TestCase {
+
+ public void testWikiPattern2SinglePositiveMatch() {
+ Matcher matcher = TracHyperlinkUtil.wikiPattern2.matcher("a HyperLink there");
+ assertTrue(matcher.find());
+ assertEquals(matcher.group(0), "HyperLink");
+ assertFalse(matcher.find());
+ }
+
+ public void testWikiPattern2MultiplePositiveMatch() {
+ Matcher matcher = TracHyperlinkUtil.wikiPattern2.matcher("a HyperLink there and ThereIsAnother");
+ assertTrue(matcher.find());
+ assertEquals(matcher.group(0), "HyperLink");
+ assertTrue(matcher.find());
+ assertEquals(matcher.group(0), "ThereIsAnother");
+ assertFalse(matcher.find());
+ }
+
+ public void testWikiPattern2SingleNegativeMatch() {
+ Matcher matcher = TracHyperlinkUtil.wikiPattern2.matcher("no !HyperLink there");
+ assertFalse(matcher.find());
+ }
+
+ public void testWikiPattern2SinglePositiveMatchAtStartOfLine() {
+ Matcher matcher = TracHyperlinkUtil.wikiPattern2.matcher("HyperLink there");
+ assertTrue(matcher.find());
+ assertEquals(matcher.group(0), "HyperLink");
+ assertFalse(matcher.find());
+ }
+
+ public void testWikiPattern2SingleNegativeMatchAtStartOfLine() {
+ Matcher matcher = TracHyperlinkUtil.wikiPattern2.matcher("!HyperLink there");
+ assertFalse(matcher.find());
+ }
+
+ public void testWikiPattern2MixedPositiveNegativeMatch() {
+ Matcher matcher = TracHyperlinkUtil.wikiPattern2.matcher("a HyperLink there and ThereIsAnother but !NotHere");
+ assertTrue(matcher.find());
+ assertEquals(matcher.group(0), "HyperLink");
+ assertTrue(matcher.find());
+ assertEquals(matcher.group(0), "ThereIsAnother");
+ assertFalse(matcher.find());
+ }
+
+}

Back to the top