Test framework now allows custom light project setup

This commit is contained in:
Anton Makeev
2015-07-07 12:30:49 +02:00
parent 5ab0eff146
commit 756d1df8eb
2 changed files with 32 additions and 1 deletions
@@ -94,7 +94,8 @@ import com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl;
import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings;
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
import com.intellij.util.Consumer;
import com.intellij.util.GCUtil;import com.intellij.util.IncorrectOperationException;
import com.intellij.util.GCUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.LocalTimeCounter;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.indexing.FileBasedIndex;
@@ -261,6 +262,12 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
ourPsiManager = null;
ourModule = createMainModule(descriptor.getModuleType());
if (descriptor instanceof LightProjectDescriptorEx) {
((LightProjectDescriptorEx)descriptor).setupModule(ourModule);
if(!((LightProjectDescriptorEx)descriptor).shouldConfigureModule()) return;
}
VirtualFile dummyRoot = VirtualFileManager.getInstance().findFileByUrl("temp:///");
assert dummyRoot != null;
dummyRoot.refresh(false, false);
@@ -0,0 +1,24 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.testFramework;
import com.intellij.openapi.module.Module;
public interface LightProjectDescriptorEx extends LightProjectDescriptor {
boolean shouldConfigureModule();
void setupModule(Module module);
}