diff options
-rw-r--r-- | org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java index ac695778e17..f48bf80c12f 100644 --- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java +++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation 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 @@ -8,7 +8,6 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ - package org.eclipse.jface.text.tests.rules; import junit.framework.TestCase; @@ -219,6 +218,42 @@ public class FastPartitionerTest extends TestCase { } + public void testBug368219_1() throws Exception { + fPartitioner.disconnect(); + IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() { + { + IToken comment= new Token(COMMENT); + IPredicateRule[] rules= new IPredicateRule[] { new MultiLineRule("/*", "*/", comment) }; + setPredicateRules(rules); + } + }; + fPartitioner= createPartitioner(scanner); + fDoc.setDocumentPartitioner(fPartitioner); + fPartitioner.connect(fDoc); + + fDoc.set("/**"); + assertEqualPartition(0, 3, DEFAULT); + + } + + public void testBug368219_2() throws Exception { + fPartitioner.disconnect(); + IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() { + { + IToken comment= new Token(COMMENT); + IPredicateRule[] rules= new IPredicateRule[] { new MultiLineRule("/*", "*/", comment, (char)0, true) }; + setPredicateRules(rules); + } + }; + fPartitioner= createPartitioner(scanner); + fDoc.setDocumentPartitioner(fPartitioner); + fPartitioner.connect(fDoc); + + fDoc.set("/**"); + assertEqualPartition(0, 3, COMMENT); + + } + private void assertComputePartitioning_InterleavingPartitions(int[] offsets) { assertComputePartitioning_InterleavingPartitions(0, fDoc.getLength(), offsets, DEFAULT); } |