1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Don't create empty test files.

This commit is contained in:
Sergey Prigogin 2012-01-19 12:45:49 -08:00
parent ecb3820c77
commit 6408fe544c

View file

@ -66,12 +66,12 @@ public abstract class RefactoringTestBase extends BaseTestCase {
protected RefactoringTestBase(String name) { protected RefactoringTestBase(String name) {
super(name); super(name);
} }
@Override @Override
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
cproject = cpp ? cproject = cpp ?
CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) : CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER); CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
Bundle bundle = CTestPlugin.getDefault().getBundle(); Bundle bundle = CTestPlugin.getDefault().getBundle();
CharSequence[] testData = TestSourceReader.getContentsForTest(bundle, "ui", getClass(), getName(), 0); CharSequence[] testData = TestSourceReader.getContentsForTest(bundle, "ui", getClass(), getName(), 0);
@ -94,9 +94,11 @@ public abstract class RefactoringTestBase extends BaseTestCase {
} }
} }
reader.close(); reader.close();
TestSourceReader.createFile(cproject.getProject(), new Path(testFile.getName()), if (!testFile.getSource().isEmpty()) {
testFile.getSource()); TestSourceReader.createFile(cproject.getProject(), new Path(testFile.getName()),
testFile.getSource());
}
testFiles.add(testFile); testFiles.add(testFile);
if (testFile.getName().endsWith(".xml")) { if (testFile.getName().endsWith(".xml")) {
historyScript = testFile; historyScript = testFile;
@ -292,7 +294,7 @@ public abstract class RefactoringTestBase extends BaseTestCase {
String actualSource = getFileContents(file); String actualSource = getFileContents(file);
assertEquals(testFile.getExpectedSource(), actualSource); assertEquals(testFile.getExpectedSource(), actualSource);
} }
protected void compareFiles() throws Exception { protected void compareFiles() throws Exception {
for (TestSourceFile testFile : testFiles) { for (TestSourceFile testFile : testFiles) {
String expectedSource = testFile.getExpectedSource(); String expectedSource = testFile.getExpectedSource();