Search in sources :

Example 1 with TempDirTestFixtureImpl

use of com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl in project intellij-community by JetBrains.

the class FindManagerTest method testFindInCurrentFileOutsideProject.

public void testFindInCurrentFileOutsideProject() throws Exception {
    final TempDirTestFixture tempDirFixture = new TempDirTestFixtureImpl();
    tempDirFixture.setUp();
    try {
        VirtualFile file = tempDirFixture.createFile("a.txt", "foo bar foo");
        FindModel findModel = FindManagerTestUtils.configureFindModel("foo");
        findModel.setWholeWordsOnly(true);
        findModel.setCustomScope(true);
        findModel.setCustomScope(new LocalSearchScope(PsiManager.getInstance(myProject).findFile(file)));
        assertSize(2, findUsages(findModel));
    } finally {
        tempDirFixture.tearDown();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LightVirtualFile(com.intellij.testFramework.LightVirtualFile) LocalSearchScope(com.intellij.psi.search.LocalSearchScope) TempDirTestFixture(com.intellij.testFramework.fixtures.TempDirTestFixture) LightTempDirTestFixtureImpl(com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl) TempDirTestFixtureImpl(com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl)

Example 2 with TempDirTestFixtureImpl

use of com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl in project intellij-community by JetBrains.

the class ModuleCompilerUtilTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myTempDirTestFixture = new TempDirTestFixtureImpl();
    myTempDirTestFixture.setUp();
}
Also used : TempDirTestFixtureImpl(com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl)

Example 3 with TempDirTestFixtureImpl

use of com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl in project intellij-community by JetBrains.

the class FindManagerTest method testFindInDirectoryOutsideProject.

public void testFindInDirectoryOutsideProject() throws Exception {
    final TempDirTestFixture tempDirFixture = new TempDirTestFixtureImpl();
    tempDirFixture.setUp();
    try {
        tempDirFixture.createFile("a.txt", "foo bar foo");
        FindModel findModel = FindManagerTestUtils.configureFindModel("foo");
        findModel.setWholeWordsOnly(true);
        findModel.setProjectScope(false);
        findModel.setDirectoryName(tempDirFixture.getFile("").getPath());
        assertSize(2, findUsages(findModel));
    } finally {
        tempDirFixture.tearDown();
    }
}
Also used : TempDirTestFixture(com.intellij.testFramework.fixtures.TempDirTestFixture) LightTempDirTestFixtureImpl(com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl) TempDirTestFixtureImpl(com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl)

Example 4 with TempDirTestFixtureImpl

use of com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl in project intellij-community by JetBrains.

the class GroovyGotoImplementationTest method testNoGotoImplementationOutsideSourceRoot.

public void testNoGotoImplementationOutsideSourceRoot() throws Throwable {
    final TempDirTestFixture dirFixture = new TempDirTestFixtureImpl();
    dirFixture.setUp();
    new WriteCommandAction(getProject()) {

        @Override
        protected void run(@NotNull Result result) throws Throwable {
            final VirtualFile outside = dirFixture.getFile("").createChildDirectory(this, "outside");
            PsiTestUtil.addContentRoot(myModule, outside);
            VirtualFile out = outside.createChildData(this, "Outside.groovy");
            VfsUtil.saveText(out, "class Bar {}\n class Goo extends Bar {}");
            PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
        }
    }.execute();
    try {
        PsiFile inProject = myFixture.addFileToProject("Foo.groovy", "class <caret>Foo {}\n class Bar extends Foo {}");
        myFixture.configureFromExistingVirtualFile(inProject.getVirtualFile());
        final PsiElement[] impls = CodeInsightTestUtil.gotoImplementation(myFixture.getEditor(), inProject).targets;
        assertEquals(1, impls.length);
    } finally {
        dirFixture.tearDown();
    }
}
Also used : WriteCommandAction(com.intellij.openapi.command.WriteCommandAction) VirtualFile(com.intellij.openapi.vfs.VirtualFile) TempDirTestFixture(com.intellij.testFramework.fixtures.TempDirTestFixture) PsiFile(com.intellij.psi.PsiFile) TempDirTestFixtureImpl(com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl) PsiElement(com.intellij.psi.PsiElement) Result(com.intellij.openapi.application.Result)

Aggregations

TempDirTestFixtureImpl (com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl)4 TempDirTestFixture (com.intellij.testFramework.fixtures.TempDirTestFixture)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 LightTempDirTestFixtureImpl (com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl)2 Result (com.intellij.openapi.application.Result)1 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)1 PsiElement (com.intellij.psi.PsiElement)1 PsiFile (com.intellij.psi.PsiFile)1 LocalSearchScope (com.intellij.psi.search.LocalSearchScope)1 LightVirtualFile (com.intellij.testFramework.LightVirtualFile)1