use of org.eclipse.jface.text.source.ICharacterPairMatcher in project webtools.sourceediting by eclipse.
the class AbstractPairMatcherTest method testBoundaries.
/**
* Test a few boundary conditions.
*
* * @throws BadLocationException
*/
public void testBoundaries() throws BadLocationException {
final ICharacterPairMatcher matcher = createMatcher("()[]{}");
final StringDocument doc = new StringDocument("abcdefghijkl");
assertNull(matcher.match(null, 0));
assertNull(matcher.match(doc, -1));
assertNull(matcher.match(doc, doc.getLength() + 1));
matcher.dispose();
}
use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.
the class AbstractPairMatcherTest method testPartitioned.
/**
* Test that it doesn't match across different partitions.
*
* @throws BadLocationException test failure
*/
@Test
public void testPartitioned() throws BadLocationException {
final ICharacterPairMatcher matcher = createMatcher("()[]{}");
performMatch(matcher, "(% |a a| )#");
performMatch(matcher, "#( |a a| )%");
performMatch(matcher, "|b #( )% b|");
performMatch(matcher, "( |b )% b|");
performMatch(matcher, "(% |b ) b|");
performMatch(matcher, "|a ( a| )%");
performMatch(matcher, "|a (% a| )");
performMatch(matcher, "|c #( c| ) ( |c )% c|");
performMatch(matcher, "|c (% c| ) ( |c )# c|");
performMatch(matcher, "(% |a ) a| |b ) b| |c ) c| )#");
performMatch(matcher, "#( % |a a| )#");
performMatch(matcher, "|b #( % )# b|");
performMatch(matcher, "|c #( % c| ) ( |c )# c|");
performMatch(matcher, "|c #( c| ) ( |c % )# c|");
performMatch(matcher, "#( % |a ) a| |b ) b| |c ) c| )#");
performMatch(matcher, "#( |a % a| )#");
performMatch(matcher, "( |a #( a| ( |a % a| ) |a )# a| )");
performMatch(matcher, "#( % % |a a| )#");
performMatch(matcher, "|b #( % % )# b|");
performMatch(matcher, "|c #( % % c| ) ( |c )# c|");
performMatch(matcher, "|c #( c| ) ( |c % % )# c|");
performMatch(matcher, "#( % % |a ) a| |b ) b| |c ) c| )#");
performMatch(matcher, " #( |c ( c| % % |c ) c| )#");
matcher.dispose();
}
use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.
the class AbstractPairMatcherTest method testBoundaries.
/**
* Test a few boundary conditions.
*
* * @throws BadLocationException test failure
*/
@Test
public void testBoundaries() throws BadLocationException {
final ICharacterPairMatcher matcher = createMatcher("()[]{}");
final StringDocument doc = new StringDocument("abcdefghijkl");
assertNull(matcher.match(null, 0));
assertNull(matcher.match(doc, -1));
assertNull(matcher.match(doc, doc.getLength() + 1));
matcher.dispose();
}
use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.
the class AbstractPairMatcherTest method testNesting.
/**
* Test that nesting works properly
*/
@Test
public void testNesting() {
final ICharacterPairMatcher matcher = createMatcher("()[]{}");
performMatch(matcher, " ( #( ( ( ) ) ( ) )% ) ");
performMatch(matcher, " ( (% ( ( ) ) ( ) )# ) ");
performMatch(matcher, " ( #( { ( ) } [ ] )% ) ");
performMatch(matcher, " ( (% { ( ) } [ ] )# ) ");
performMatch(matcher, " ( ( #{ ( ) }% [ ] ) ) ");
performMatch(matcher, " ( ( {% ( ) }# [ ] ) ) ");
performMatch(matcher, "a(b#(c(d(e)f)g(h)i)%j)k");
performMatch(matcher, "a(b(%c(d(e)f)g(h)i)#j)k");
performMatch(matcher, "a(b#(c{d(e)f}g[h]i)%j)k");
performMatch(matcher, "a(b(%c{d(e)f}g[h]i)#j)k");
performMatch(matcher, "a(b(c#{d(e)f}%g[h]i)j)k");
performMatch(matcher, "a(b(c{%d(e)f}#g[h]i)j)k");
performMatch(matcher, " ( #( ( ( ) ) ( ) % )# ) ");
performMatch(matcher, " ( #( % ( ( ) ) ( ) )# ) ");
performMatch(matcher, " ( #( { ( ) } [ ] % )# ) ");
performMatch(matcher, " ( #( % { ( ) } [ ] )# ) ");
performMatch(matcher, " ( ( #{ ( ) % }# [ ] ) ) ");
performMatch(matcher, " ( ( #{ % ( ) }# [ ] ) ) ");
performMatch(matcher, "a(b#(c(d(e)f)g(h)i%)#j)k");
performMatch(matcher, "a(b#(%c(d(e)f)g(h)i)#j)k");
performMatch(matcher, "a(b#(c{d(e)f}g[h]i%)#j)k");
performMatch(matcher, "a(b#(%c{d(e)f}g[h]i)#j)k");
performMatch(matcher, "a(b(c#{d(e)f%}#g[h]i)j)k");
performMatch(matcher, "a(b(c#{%d(e)f}#g[h]i)j)k");
matcher.dispose();
}
use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.
the class AbstractPairMatcherTest method testBug156426.
@Test
public void testBug156426() {
final ICharacterPairMatcher matcher = createMatcher("()[]{}<>");
performMatch(matcher, " #( a < b )% ");
performMatch(matcher, " (% a < b )# ");
performMatch(matcher, " #( a > b )% ");
performMatch(matcher, " (% a > b )# ");
matcher.dispose();
}
Aggregations