diff options
author | spingel | 2008-08-15 19:50:59 +0000 |
---|---|---|
committer | spingel | 2008-08-15 19:50:59 +0000 |
commit | 4ee54166e8ef750bcf05e0425500bf4299c8149a (patch) | |
tree | dfbb91ab80704cd1d02b2058738dc6bc51d3eacd /org.eclipse.mylyn.trac.tests/src/org | |
parent | f7a0decd17827c154cfddf9936bd863f681dffbc (diff) | |
download | org.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')
-rw-r--r-- | org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtilStandaloneTest.java | 62 |
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()); + } + +} |