1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 574331: Set default query results for tests

Most of the tests in this bundle already had this bit of code
before calling create project. This makes BuildDescriptionModelTests
consistent with the rest.

Note that this modifies global state and does not restore it. However,
as that is consistent with the other tests in this bundle, and the
global state is only maintained while running tests on this bundle,
I am not fixing this aspect of the code.

Change-Id: I2004af177a959e1efbd45b23c960b517d8993b7c
This commit is contained in:
Jonah Graham 2021-06-19 15:32:31 -04:00
parent 83f0b1be05
commit 90b3ebc1df

View file

@ -55,6 +55,7 @@ import org.eclipse.cdt.managedbuilder.internal.buildmodel.DbgUtil;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration; import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException; import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider; import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.projectconverter.UpdateManagedProjectManager;
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper; import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
@ -62,6 +63,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.ui.dialogs.IOverwriteQuery;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
@ -877,6 +879,17 @@ public class BuildDescriptionModelTests extends TestCase {
} }
private IProject createProject(String name, String id) { private IProject createProject(String name, String id) {
// In case the projects need to be updated...
IOverwriteQuery queryALL = new IOverwriteQuery() {
@Override
public String queryOverwrite(String file) {
return ALL;
}
};
UpdateManagedProjectManager.setBackupFileOverwriteQuery(queryALL);
UpdateManagedProjectManager.setUpdateProjectQuery(queryALL);
IProject proj = ManagedBuildTestHelper.createProject(name, id); IProject proj = ManagedBuildTestHelper.createProject(name, id);
if (proj != null) if (proj != null)
fCompositeCleaner.addRunnable(new ProjectCleaner(proj)); fCompositeCleaner.addRunnable(new ProjectCleaner(proj));