Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2012-11-10 17:35:11 +0000
committerStephan Herrmann2012-11-10 17:35:11 +0000
commitb51389cce280bda96f64b4767a95a63eae9db804 (patch)
treee161e432fb19fd6cca287a4cda8e90ce8966f0e1 /testplugins
parent319fcbbb1b4bc7107ad0477a862967296a85bbda (diff)
downloadorg.eclipse.objectteams-b51389cce280bda96f64b4767a95a63eae9db804.tar.gz
org.eclipse.objectteams-b51389cce280bda96f64b4767a95a63eae9db804.tar.xz
org.eclipse.objectteams-b51389cce280bda96f64b4767a95a63eae9db804.zip
Bug 394034 - [assist] completing a method call does not propose an
argument with declared lifting - test & fix
Diffstat (limited to 'testplugins')
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java
index ccecbfc8e..eda00f9fc 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java
@@ -1713,6 +1713,47 @@ public class CodeCompletionTest extends CoreTests {
assertTrue("Unexpected additional info", proposal.getAdditionalProposalInfo().endsWith(expectedInfo));
}
+ // propose methods invoked via a phantom role, simple nested case
+ public void testMethodInvocation5() throws CoreException {
+
+ createBaseClass("test1", "B", "public boolean check() { return false; }");
+
+ StringBuffer subTeamContent = new StringBuffer();
+ subTeamContent.append("package test1;\n");
+ subTeamContent.append("public team class Completion_testMethodInvocation5 {\n");
+ subTeamContent.append(" protected class R playedBy B {\n");
+ subTeamContent.append(" protected void foo() {}\n");
+ subTeamContent.append(" }\n");
+ subTeamContent.append(" java.util.List<R> roles;\n");
+ subTeamContent.append(" void test(B as R rarg) {\n");
+ subTeamContent.append(" roles.\n");
+ subTeamContent.append(" }\n");
+ subTeamContent.append(" }\n");
+ subTeamContent.append("}");
+
+ StringBuffer expectedContent = new StringBuffer();
+ expectedContent.append("package test1;\n");
+ expectedContent.append("public team class Completion_testMethodInvocation5 {\n");
+ expectedContent.append(" protected class R playedBy B {\n");
+ expectedContent.append(" protected void foo() {}\n");
+ expectedContent.append(" }\n");
+ expectedContent.append(" java.util.List<R> roles;\n");
+ expectedContent.append(" void test(B as R rarg) {\n");
+ expectedContent.append(" roles.add(arg0)\n");
+ expectedContent.append(" }\n");
+ expectedContent.append(" }\n");
+ expectedContent.append("}");
+
+
+ String completeAfter = "roles.";
+ int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
+ int posAfter = expectedContent.indexOf("roles.add(arg0)")+10; // at start of argument
+
+ ICompletionProposal proposal = assertProposal("add", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 4), 0);
+ assertTrue("Should be a parameter guessing proposal", proposal instanceof ParameterGuessingProposal);
+ assertChoices(proposal, new String[][]{new String[]{"arg0", "rarg", "null"}}); // <- this is key: expect "rarg" next to "arg0"!
+ }
+
// == Below: Helper methods/fields. ==
private void createBaseClass(String classBody)

Back to the top