diff options
| author | Laurent Fasani | 2018-01-05 17:30:57 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2018-01-30 16:44:34 +0000 |
| commit | 70dab79adbd89cf39bcd12286a7e4e5b466dd3c1 (patch) | |
| tree | 64943a11380ae9ba4beca514b065ce9a40092c8e | |
| parent | a3393ba4f56b52a4dc6b16f4119b1d84b96ba80c (diff) | |
| download | org.eclipse.sirius-70dab79adbd89cf39bcd12286a7e4e5b466dd3c1.tar.gz org.eclipse.sirius-70dab79adbd89cf39bcd12286a7e4e5b466dd3c1.tar.xz org.eclipse.sirius-70dab79adbd89cf39bcd12286a7e4e5b466dd3c1.zip | |
[479826] Add completion tests for aql when invoked on meta-model part
* The fix has been done in acceleo with Bug 529808. When the completion
is called on part of a registered meta-model, all types of this
meta-model are proposed
* Add a test in AcceleoQueryLanguageCompletionTests
Bug:479826
Change-Id: Iefb637adc6879bdd47a94cf9c3a6ddb31d62fa38
Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
| -rw-r--r-- | plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/aql/AcceleoQueryLanguageCompletionTests.java | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/aql/AcceleoQueryLanguageCompletionTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/aql/AcceleoQueryLanguageCompletionTests.java index 241e2f179c..9f1154e557 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/aql/AcceleoQueryLanguageCompletionTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/aql/AcceleoQueryLanguageCompletionTests.java @@ -63,8 +63,7 @@ public class AcceleoQueryLanguageCompletionTests extends AbstractCompletionTestC } /** - * Test the completion with replacement of a part of the expression before - * the cursor. + * Test the completion with replacement of a part of the expression before the cursor. */ public void testAQLProposalWithPreviousReplacement() { EClass c = EcoreFactory.eINSTANCE.createEClass(); @@ -137,6 +136,39 @@ public class AcceleoQueryLanguageCompletionTests extends AbstractCompletionTestC assertEquals("Attribute", proposal.getProposal()); } + /** + * Test the completion with PROPOSAL_INSERT after a part of the meta-model name where the cursor is.</br> + * The replaced string is a remaining part of the domain type qualified with meta-model. + */ + public void testAQLProposalForDomainMetaModel_ContentProposal() { + EClass c = EcoreFactory.eINSTANCE.createEClass(); + c.setName("FirstEClass"); + + ContentContext contentContext = createContentContext("aql:self.eAllContents(eco)", "aql:self.eAllContents(eco".length(), c, ""); + List<ContentProposal> proposals = this.getProposals(contentContext); + + assertEquals(53, proposals.size()); + + ContentProposal proposal = proposals.get(0); + assertEquals("re::EAttribute", proposal.getProposal()); + } + + /** + * Test the completion with PROPOSAL_REPLACE after a part of the meta-model name where the cursor is.</br> + * The replaced string is a remaining part of the domain type qualified with meta-model. + */ + public void testAQLProposalForDomainMetaModel_ContentInstanceContext() { + EClass c = EcoreFactory.eINSTANCE.createEClass(); + c.setName("FirstEClass"); + + ContentInstanceContext cic = new ContentInstanceContext(c, "aql:self.eAllContents(eco)", "aql:self.eAllContents(eco".length()); + List<ContentProposal> proposals = this.getProposals(cic); + + assertEquals(53, proposals.size()); + + ContentProposal proposal = proposals.get(0); + assertEquals("ecore::EAttribute", proposal.getProposal()); + } /** * Test the completion with replacement of a part of the expression after the cursor. @@ -160,8 +192,7 @@ public class AcceleoQueryLanguageCompletionTests extends AbstractCompletionTestC } /** - * Test the completion with replacement of a part of the expression before - * and after the cursor. + * Test the completion with replacement of a part of the expression before and after the cursor. */ public void testAQLWithBeforeAndAfterReplacement() { EClass c = EcoreFactory.eINSTANCE.createEClass(); |
