-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#3007] Content Assistant test infrastructure improvements.
- Extend the Content Assistant test infrastructure to test proposals from several resources: modify the AbstractContentAssistTest getResourceFor method to ensure that the test file points to a file in the test project. - Uplift the testContentAssistant method from the project example classes into the AbstractContentAssistTest and rename it to assertContentAssistant. - Add the events_from_another_file() test case to the StatemachineContentAssistTest test cases to demonstrate how to test the content assistant with several resources. - Also add the ContentAssistWithSeveralResourcesTest test cases that are continuously executed by the CI build. Closes #3007 Signed-off-by: miklossy <miklossy@itemis.de>
- Loading branch information
Showing
8 changed files
with
325 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...rg/eclipse/xtext/ui/tests/editor/contentassist/ContentAssistWithSeveralResourcesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 itemis AG (http://www.itemis.eu) and others. | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.xtext.ui.tests.editor.contentassist; | ||
|
||
import org.eclipse.xtext.testing.InjectWith; | ||
import org.eclipse.xtext.testing.XtextRunner; | ||
import org.eclipse.xtext.ui.testing.AbstractContentAssistTest; | ||
import org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil; | ||
import org.eclipse.xtext.ui.tests.linking.ui.tests.ImportUriUiTestLanguageUiInjectorProvider; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* @author miklossy - Initial contribution and API | ||
*/ | ||
@RunWith(XtextRunner.class) | ||
@InjectWith(ImportUriUiTestLanguageUiInjectorProvider.class) | ||
public class ContentAssistWithSeveralResourcesTest extends AbstractContentAssistTest { | ||
|
||
@Test public void test_with_one_resource() { | ||
assertContentAssistant("type A extends " + c, new String[]{("A")}); | ||
} | ||
|
||
@Test public void test_with_two_resources() { | ||
createDslFile("types", "type A extends A"); | ||
IResourcesSetupUtil.waitForBuild(); | ||
assertContentAssistant("import \"types.importuriuitestlanguage\" type B extends " + c, "A\nB"); | ||
} | ||
|
||
@Test public void test_with_three_resources() { | ||
createDslFile("types1", "type A extends A"); | ||
createDslFile("types2", "type B extends B"); | ||
IResourcesSetupUtil.waitForBuild(); | ||
assertContentAssistant("import \"types1.importuriuitestlanguage\" import \"types2.importuriuitestlanguage\" type C extends " + c, new String[]{"A", "B", "C"}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.