middle matching in xpath tests

This commit is contained in:
peter
2012-07-16 21:24:51 +02:00
parent a1525c1a98
commit 3a19d9c4ad
4 changed files with 17 additions and 23 deletions
@@ -15,23 +15,19 @@
*/
package org.intellij.lang.xpath;
import com.intellij.codeInsight.completion.impl.CamelHumpMatcher;
public class XPath2CompletionTest extends TestBase {
public void testCastInsert() throws Throwable {
CamelHumpMatcher.forceStartMatching(getTestRootDisposable());
doXPathCompletion();
final String name = getTestFileName();
myFixture.testCompletion(name + ".xpath2", name + "_after.xpath2");
}
public void testTreatInsert() throws Throwable {
CamelHumpMatcher.forceStartMatching(getTestRootDisposable());
doXPathCompletion();
}
private void doXPathCompletion() throws Throwable {
final String name = getTestFileName();
myFixture.testCompletion(name + ".xpath2", name + "_after.xpath2");
myFixture.configureByFile(name + ".xpath2");
myFixture.completeBasic();
myFixture.type('\n');
myFixture.checkResultByFile(name + "_after.xpath2");
}
@Override
@@ -15,14 +15,7 @@
*/
package org.intellij.lang.xpath;
import com.intellij.codeInsight.completion.impl.CamelHumpMatcher;
public class XPathCompletionTest extends TestBase {
@Override
protected void setUp() throws Exception {
super.setUp();
CamelHumpMatcher.forceStartMatching(getTestRootDisposable());
}
public void testAxis() throws Throwable {
doXPathCompletion("ancestor", "ancestor-or-self", "attribute");
@@ -33,7 +26,7 @@ public class XPathCompletionTest extends TestBase {
}
public void testPartialAxis() throws Throwable {
doXPathCompletion();
doXPathCompletion("ancestor", "ancestor-or-self");
}
public void testFunctions() throws Throwable {
@@ -50,11 +43,17 @@ public class XPathCompletionTest extends TestBase {
private void doXPathCompletion() throws Throwable {
final String name = getTestFileName();
myFixture.testCompletion(name + ".xpath", name + "_after.xpath");
myFixture.configureByFile(name + ".xpath");
if (myFixture.completeBasic() != null) {
myFixture.type('\n');
}
myFixture.checkResultByFile(name + "_after.xpath");
}
private void doXPathCompletion(String... expectedVariants) throws Throwable {
myFixture.testCompletionVariants(getTestFileName() + ".xpath", expectedVariants);
private void doXPathCompletion(String... expectedVariants) {
myFixture.configureByFile(getTestFileName() + ".xpath");
myFixture.completeBasic();
myFixture.assertPreferredCompletionItems(0, expectedVariants);
}
@Override
@@ -1 +1 @@
an<caret>::
anc<caret>::
@@ -1 +0,0 @@
ancestor<caret>::