From 3a19d9c4ad99ecf2ed2e088e66e1b7b153f1be29 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 16 Jul 2012 21:24:51 +0200 Subject: [PATCH] middle matching in xpath tests --- .../lang/xpath/XPath2CompletionTest.java | 16 ++++++-------- .../lang/xpath/XPathCompletionTest.java | 21 +++++++++---------- .../xpath/completion/partialAxis.xpath | 2 +- .../xpath/completion/partialAxis_after.xpath | 1 - 4 files changed, 17 insertions(+), 23 deletions(-) delete mode 100644 plugins/xpath/xpath-lang/testData/xpath/completion/partialAxis_after.xpath diff --git a/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPath2CompletionTest.java b/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPath2CompletionTest.java index 11fc06f2cb5a..404218afb757 100644 --- a/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPath2CompletionTest.java +++ b/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPath2CompletionTest.java @@ -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 diff --git a/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPathCompletionTest.java b/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPathCompletionTest.java index 1719b0438024..f2606acae528 100644 --- a/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPathCompletionTest.java +++ b/plugins/xpath/xpath-lang/test/org/intellij/lang/xpath/XPathCompletionTest.java @@ -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 diff --git a/plugins/xpath/xpath-lang/testData/xpath/completion/partialAxis.xpath b/plugins/xpath/xpath-lang/testData/xpath/completion/partialAxis.xpath index 63b460357483..5dc223400a3f 100644 --- a/plugins/xpath/xpath-lang/testData/xpath/completion/partialAxis.xpath +++ b/plugins/xpath/xpath-lang/testData/xpath/completion/partialAxis.xpath @@ -1 +1 @@ -an:: \ No newline at end of file +anc:: \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/testData/xpath/completion/partialAxis_after.xpath b/plugins/xpath/xpath-lang/testData/xpath/completion/partialAxis_after.xpath deleted file mode 100644 index 9838636fa2d1..000000000000 --- a/plugins/xpath/xpath-lang/testData/xpath/completion/partialAxis_after.xpath +++ /dev/null @@ -1 +0,0 @@ -ancestor:: \ No newline at end of file