Search in sources :

Example 1 with ICharacterPairMatcher

use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.

the class AbstractPairMatcherTest method testCloseMatches.

/**
 * Close matches.
 *
 * @throws BadLocationException test failure
 */
@Test
public void testCloseMatches() throws BadLocationException {
    final ICharacterPairMatcher matcher = createMatcher("()[]{}");
    performMatch(matcher, "(%)#");
    performMatch(matcher, "#(())%");
    performMatch(matcher, "(%())#");
    performMatch(matcher, "((%)#)");
    performMatch(matcher, "%(%)#");
    performMatch(matcher, "#(()%)%");
    performMatch(matcher, "%(%())#");
    performMatch(matcher, "(%(%)#)");
    performMatch(matcher, "#(%)#");
    performMatch(matcher, "#(%())#");
    performMatch(matcher, "#(% %)#");
    performMatch(matcher, "#(% %())#");
    matcher.dispose();
}
Also used : ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher) Test(org.junit.Test)

Example 2 with ICharacterPairMatcher

use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.

the class AbstractPairMatcherTest method testIncompleteMatch.

/**
 * Checks of simple situations where no matches should be found.
 *
 * @throws BadLocationException test failure
 */
@Test
public void testIncompleteMatch() throws BadLocationException {
    final ICharacterPairMatcher matcher = createMatcher("()[]{}");
    performMatch(matcher, "(% ");
    performMatch(matcher, "( % )");
    performMatch(matcher, "%");
    matcher.dispose();
}
Also used : ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher) Test(org.junit.Test)

Example 3 with ICharacterPairMatcher

use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.

the class AbstractPairMatcherTest method performMatch.

private void performMatch(final String delims, final String testCase) {
    final ICharacterPairMatcher matcher = createMatcher(delims);
    performMatch(matcher, testCase);
    matcher.dispose();
}
Also used : ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher)

Example 4 with ICharacterPairMatcher

use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.

the class DefaultPairMatcherTest method testIncompleteMatch1.

/**
 * Checks of simple situations where no matches should be found.
 *
 * @throws BadLocationException test failure
 */
@Test
public void testIncompleteMatch1() throws BadLocationException {
    final ICharacterPairMatcher matcher = createMatcher("()[]{}");
    performMatch(matcher, "(  %)");
    performMatch(matcher, "%(  )");
    matcher.dispose();
}
Also used : ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher) Test(org.junit.Test)

Example 5 with ICharacterPairMatcher

use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.

the class DefaultPairMatcherTest method testCloseMatches1.

/**
 * Close matches.
 *
 * @throws BadLocationException test failure
 */
@Test
public void testCloseMatches1() throws BadLocationException {
    final ICharacterPairMatcher matcher = createMatcher("()[]{}");
    performMatch(matcher, "#()%");
    performMatch(matcher, "(#()%)");
    matcher.dispose();
}
Also used : ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher) Test(org.junit.Test)

Aggregations

ICharacterPairMatcher (org.eclipse.jface.text.source.ICharacterPairMatcher)26 Test (org.junit.Test)12 DefaultCharacterPairMatcher (org.eclipse.jface.text.source.DefaultCharacterPairMatcher)3 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 Point (org.eclipse.swt.graphics.Point)2 IDocument (org.eclipse.jface.text.IDocument)1 IRegion (org.eclipse.jface.text.IRegion)1 ITextViewerExtension5 (org.eclipse.jface.text.ITextViewerExtension5)1 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)1 ExtendedConfigurationBuilder (org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)1