[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Patch for org.eclipse.cdt.ui.tests
|
Attached is a patch I am about to commit into org.eclipse.cdt.ui.tests.
There are no new tests there, but I have changed all the QNX specific pr
numbers to the equivalent bugzilla pr number. The patch also includes
some general cleanups (removed unused imports/variables etc.)
-Peter Graves
Index: model/org/eclipse/cdt/core/model/tests/AllCoreTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/AllCoreTests.java,v
retrieving revision 1.1
diff -u -r1.1 AllCoreTests.java
--- model/org/eclipse/cdt/core/model/tests/AllCoreTests.java 15 Sep 2002 20:28:53 -0000 1.1
+++ model/org/eclipse/cdt/core/model/tests/AllCoreTests.java 27 Sep 2002 12:23:28 -0000
@@ -4,8 +4,6 @@
* All Rights Reserved.
*/
-import org.eclipse.cdt.internal.core.model.TranslationUnit;
-import org.eclipse.cdt.testplugin.util.*;
import junit.framework.Test;
import junit.framework.TestSuite;
Index: model/org/eclipse/cdt/core/model/tests/ArchiveTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/ArchiveTests.java,v
retrieving revision 1.1
diff -u -r1.1 ArchiveTests.java
--- model/org/eclipse/cdt/core/model/tests/ArchiveTests.java 15 Sep 2002 20:28:53 -0000 1.1
+++ model/org/eclipse/cdt/core/model/tests/ArchiveTests.java 27 Sep 2002 12:23:28 -0000
@@ -6,7 +6,6 @@
*/
-import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -15,12 +14,8 @@
import org.eclipse.cdt.testplugin.*;
import org.eclipse.cdt.testplugin.util.*;
import org.eclipse.cdt.core.model.*;
-import org.eclipse.core.internal.runtime.Log;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.internal.core.model.*;
@@ -144,7 +139,7 @@
*/
public void testArchive() throws CoreException {
- Archive myArchive;
+ Archive myArchive;
boolean caught;
myArchive=null;
@@ -154,7 +149,7 @@
} catch (IllegalArgumentException e) {
caught=true;
}
- assertTrue("PR:12037 Created an archive with a C file", caught);
+ assertTrue("PR:23601 Created an archive with a C file", caught);
myArchive=null;
caught=false;
try {
@@ -244,7 +239,6 @@
ExpectedStrings expBin, expObj[];
String[] myStrings;
int x;
- IArchive[] myArchives;
/****
Index: model/org/eclipse/cdt/core/model/tests/BinaryTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/BinaryTests.java,v
retrieving revision 1.1
diff -u -r1.1 BinaryTests.java
--- model/org/eclipse/cdt/core/model/tests/BinaryTests.java 15 Sep 2002 20:28:53 -0000 1.1
+++ model/org/eclipse/cdt/core/model/tests/BinaryTests.java 27 Sep 2002 12:23:28 -0000
@@ -6,7 +6,6 @@
*/
-import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -15,12 +14,8 @@
import org.eclipse.cdt.testplugin.*;
import org.eclipse.cdt.testplugin.util.*;
import org.eclipse.cdt.core.model.*;
-import org.eclipse.core.internal.runtime.Log;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.internal.core.model.*;
@@ -188,7 +183,7 @@
* getting their archives from the project, not creating them themselves
*/
public void testBinary() throws CoreException {
- Binary myBinary;
+ Binary myBinary;
boolean caught;
myBinary=null;
@@ -198,7 +193,7 @@
} catch (IllegalArgumentException e) {
caught=true;
}
- assertTrue("PR:13037 Created an Binary with a C file", caught);
+ assertTrue("PR:23601 Created an Binary with a C file", caught);
myBinary=null;
caught=false;
try {
@@ -331,12 +326,12 @@
* Since there is no comment on this function, I have no idea what
* it is ment to do. Once I find out what it's ment to do, I will
* actually write some tests.
- * PR13052
+ * PR23602
*/
assertTrue("Expected 76 Got: " + bigBinary.getData(), bigBinary.getData()==76);
assertTrue("Expected 8, Got: " + littleBinary.getData(), littleBinary.getData()==8);
} else
- fail("PR:13052 No docs, can't test");
+ fail("PR:23602 No docs, can't test");
}
/***
@@ -423,13 +418,13 @@
* Since there is no comment on this function, I have no idea what
* it is ment to do. Once I find out what it's ment to do, I will
* actually write some tests.
- * PR13052
+ * PR23602
*/
assertTrue("Expected 296, Got: " + bigBinary.getText(), bigBinary.getText()==296);
assertTrue("Expected 296, Got: " + littleBinary.getText(), littleBinary.getText()==296);
} else
- fail("PR:13052 No docs, can't test");
+ fail("PR:23602 No docs, can't test");
}
/***
Index: model/org/eclipse/cdt/core/model/tests/CModelTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/CModelTests.java,v
retrieving revision 1.1
diff -u -r1.1 CModelTests.java
--- model/org/eclipse/cdt/core/model/tests/CModelTests.java 15 Sep 2002 20:28:53 -0000 1.1
+++ model/org/eclipse/cdt/core/model/tests/CModelTests.java 27 Sep 2002 12:23:28 -0000
@@ -15,9 +15,6 @@
import org.eclipse.cdt.core.model.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.CProjectNature;
/**
@@ -146,7 +143,6 @@
*/
public void testFileType() throws CoreException,FileNotFoundException {
ICProject testProject;
- ICFile myfile;
testProject=CProjectHelper.createCProject("filetest", "none");
if (testProject==null)
fail("Unable to create project");
Index: model/org/eclipse/cdt/core/model/tests/FlagTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/FlagTests.java,v
retrieving revision 1.1
diff -u -r1.1 FlagTests.java
--- model/org/eclipse/cdt/core/model/tests/FlagTests.java 15 Sep 2002 20:28:53 -0000 1.1
+++ model/org/eclipse/cdt/core/model/tests/FlagTests.java 27 Sep 2002 12:23:28 -0000
@@ -9,12 +9,9 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.eclipse.cdt.testplugin.*;
import org.eclipse.cdt.core.model.*;
import org.eclipse.cdt.internal.core.model.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
/**
* @author Peter Graves
*
Index: model/org/eclipse/cdt/core/model/tests/TranslationUnitTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/model/org/eclipse/cdt/core/model/tests/TranslationUnitTests.java,v
retrieving revision 1.1
diff -u -r1.1 TranslationUnitTests.java
--- model/org/eclipse/cdt/core/model/tests/TranslationUnitTests.java 15 Sep 2002 20:28:53 -0000 1.1
+++ model/org/eclipse/cdt/core/model/tests/TranslationUnitTests.java 27 Sep 2002 12:23:28 -0000
@@ -6,14 +6,9 @@
*/
-import java.io.BufferedInputStream;
-import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.FileReader;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
import java.util.Stack;
import junit.framework.TestCase;
@@ -21,12 +16,8 @@
import org.eclipse.cdt.testplugin.*;
import org.eclipse.cdt.testplugin.util.*;
import org.eclipse.cdt.core.model.*;
-import org.eclipse.core.internal.runtime.Log;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.internal.core.model.*;
@@ -196,7 +187,7 @@
} catch (IllegalArgumentException e) {
caught=true;
}
- assertTrue("PR:13037 Created an TranslationUnit with a .o file", caught);
+ assertTrue("PR:23601 Created an TranslationUnit with a .o file", caught);
myTranslationUnit=null;
caught=false;
try {
@@ -293,7 +284,7 @@
expectedString.foundString(elements[x].getElementName());
}
}
- assertTrue("PR:13062 " +expectedString.getMissingString(),expectedString.gotAll());
+ assertTrue("PR:23603 " +expectedString.getMissingString(),expectedString.gotAll());
assertTrue(expectedString.getExtraString(),!expectedString.gotExtra());
}
@@ -319,7 +310,7 @@
}
if (!missing.empty()) {
- String output=new String("PR: 13062 Could not get elements: ");
+ String output=new String("PR:23603 Could not get elements: ");
while (!missing.empty())
output+=missing.pop() + " ";
assertTrue(output, false);
@@ -342,7 +333,7 @@
missing.push(expectedStringList[x]);
else {
if (expectedStringList[x].equals("mystruct_t")) {
- assertTrue("PR: 13062 expected:" + expectedStringList[x] + " Got:" + myElement.getElementName(),
+ assertTrue("PR:23603 expected:" + expectedStringList[x] + " Got:" + myElement.getElementName(),
expectedStringList[x].equals(myElement.getElementName()));
} else {
assertTrue("Expected:" + expectedStringList[x] + " Got:" + myElement.getElementName(),
@@ -353,7 +344,7 @@
}
if (!missing.empty()) {
- String output=new String("PR: 13062 Could not get elements: ");
+ String output=new String("PR: 23603 Could not get elements: ");
while (!missing.empty())
output+=missing.pop() + " ";
assertTrue(output, false);
@@ -374,7 +365,7 @@
if (myInclude==null)
fail("Unable to get include: " + includes[x]);
else
- assertTrue("PR:BZ23478 Expected:"+includes[x] +" Got:"+ myInclude.getIncludeName(), includes[x].equals(myInclude.getIncludeName()));
+ assertTrue("PR:23478 Expected:"+includes[x] +" Got:"+ myInclude.getIncludeName(), includes[x].equals(myInclude.getIncludeName()));
}
@@ -388,7 +379,7 @@
ExpectedStrings myExp= new ExpectedStrings(includes);
int x;
TranslationUnit myTranslationUnit=CProjectHelper.findTranslationUnit(testProject,"exetest.c");
- fail("Unable to test because we can't get the name of an include file (PR: BZ23478");
+ fail("PR:23478 Unable to test because we can't get the name of an include file");
myIncludes=myTranslationUnit.getIncludes();
for (x=0;x<myIncludes.length;x++) {
@@ -399,8 +390,5 @@
}
-
-
-
-
+
}
Index: src/org/eclipse/cdt/testplugin/CProjectHelper.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/testplugin/CProjectHelper.java,v
retrieving revision 1.2
diff -u -r1.2 CProjectHelper.java
--- src/org/eclipse/cdt/testplugin/CProjectHelper.java 15 Sep 2002 20:36:53 -0000 1.2
+++ src/org/eclipse/cdt/testplugin/CProjectHelper.java 27 Sep 2002 12:23:28 -0000
@@ -1,11 +1,7 @@
package org.eclipse.cdt.testplugin;
import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
import java.util.zip.ZipFile;
import org.eclipse.cdt.core.CCorePlugin;
@@ -21,9 +17,7 @@
import org.eclipse.cdt.internal.core.model.ArchiveContainer;
import org.eclipse.cdt.core.model.IArchive;
import org.eclipse.cdt.core.model.IBinary;
-import org.eclipse.cdt.internal.core.model.CModelManager;
import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
@@ -148,7 +142,6 @@
* Attempts to find an archive with the given name in the workspace
*/
public static Archive findArchive(ICProject testProject,String name) {
- Archive myArchive;
int x;
IArchive[] myArchives;
ArchiveContainer archCont;
@@ -163,7 +156,6 @@
myArchives=testProject.getArchiveContainer().getArchives();
if (myArchives.length<1)
return(null);
- myArchive=null;
for (x=0;x<myArchives.length;x++) {
if (myArchives[x].getElementName().equals(name))
if (myArchives[x] instanceof Archive) {
@@ -179,7 +171,6 @@
* Attempts to find a binary with the given name in the workspace
*/
public static Binary findBinary(ICProject testProject,String name) {
- Binary myBinary;
BinaryContainer binCont;
int x;
IBinary[] myBinaries;
@@ -190,7 +181,6 @@
myBinaries=binCont.getBinaries();
if (myBinaries.length<1)
return(null);
- myBinary=null;
for (x=0;x<myBinaries.length;x++) {
if (myBinaries[x].getElementName().equals(name))
if (myBinaries[x] instanceof Binary) {
@@ -206,13 +196,11 @@
* Attempts to find an object with the given name in the workspace
*/
public static Binary findObject(ICProject testProject,String name) {
- ICElement myICElement;
int x;
ICElement[] myElements;
myElements=testProject.getChildren();
if (myElements.length<1)
return(null);
- myICElement=null;
for (x=0;x<myElements.length;x++) {
if (myElements[x].getElementName().equals(name))
if (myElements[x] instanceof ICElement) {
@@ -227,13 +215,11 @@
* Attempts to find a TranslationUnit with the given name in the workspace
*/
public static TranslationUnit findTranslationUnit(ICProject testProject,String name) {
- ICElement myICElement;
int x;
ICElement[] myElements;
myElements=testProject.getChildren();
if (myElements.length<1)
return(null);
- myICElement=null;
for (x=0;x<myElements.length;x++) {
if (myElements[x].getElementName().equals(name))
if (myElements[x] instanceof ICElement) {
@@ -251,13 +237,11 @@
* Attempts to find an element with the given name in the workspace
*/
public static ICElement findElement(ICProject testProject,String name) {
- ICElement myICElement;
int x;
ICElement[] myElements;
myElements=testProject.getChildren();
if (myElements.length<1)
return(null);
- myICElement=null;
for (x=0;x<myElements.length;x++) {
if (myElements[x].getElementName().equals(name))
if (myElements[x] instanceof ICElement) {
Index: src/org/eclipse/cdt/testplugin/CTestSetup.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/testplugin/CTestSetup.java,v
retrieving revision 1.1
diff -u -r1.1 CTestSetup.java
--- src/org/eclipse/cdt/testplugin/CTestSetup.java 20 Aug 2002 16:35:03 -0000 1.1
+++ src/org/eclipse/cdt/testplugin/CTestSetup.java 27 Sep 2002 12:23:28 -0000
@@ -7,7 +7,6 @@
import junit.extensions.TestSetup;
import junit.framework.Test;
-import org.eclipse.core.resources.IWorkspaceRoot;
public class CTestSetup extends TestSetup {
Index: src/org/eclipse/cdt/testplugin/NewMain.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/testplugin/NewMain.java,v
retrieving revision 1.1
diff -u -r1.1 NewMain.java
--- src/org/eclipse/cdt/testplugin/NewMain.java 20 Aug 2002 16:35:03 -0000 1.1
+++ src/org/eclipse/cdt/testplugin/NewMain.java 27 Sep 2002 12:23:28 -0000
@@ -6,7 +6,6 @@
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.Properties;
Index: src/org/eclipse/cdt/testplugin/test/HelloWorld.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/testplugin/test/HelloWorld.java,v
retrieving revision 1.1
diff -u -r1.1 HelloWorld.java
--- src/org/eclipse/cdt/testplugin/test/HelloWorld.java 20 Aug 2002 16:35:03 -0000 1.1
+++ src/org/eclipse/cdt/testplugin/test/HelloWorld.java 27 Sep 2002 12:23:28 -0000
@@ -11,7 +11,6 @@
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.testplugin.CProjectHelper;
import org.eclipse.cdt.testplugin.TestPluginLauncher;
-import org.eclipse.core.runtime.Path;
public class HelloWorld extends TestCase {
Index: src/org/eclipse/cdt/testplugin/util/ExpectedStrings.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/testplugin/util/ExpectedStrings.java,v
retrieving revision 1.1
diff -u -r1.1 ExpectedStrings.java
--- src/org/eclipse/cdt/testplugin/util/ExpectedStrings.java 15 Sep 2002 20:36:53 -0000 1.1
+++ src/org/eclipse/cdt/testplugin/util/ExpectedStrings.java 27 Sep 2002 12:23:28 -0000
@@ -86,7 +86,6 @@
return(missing);
}
public String getExtraString() {
- int x;
String extra= new String("Extra elements: ");
while (!extraStrings.empty()) {
extra+=extraStrings.pop();
Index: ui/org/eclipse/cdt/ui/tests/dialogs/PreferencesTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/dialogs/PreferencesTest.java,v
retrieving revision 1.1
diff -u -r1.1 PreferencesTest.java
--- ui/org/eclipse/cdt/ui/tests/dialogs/PreferencesTest.java 20 Aug 2002 16:35:14 -0000 1.1
+++ ui/org/eclipse/cdt/ui/tests/dialogs/PreferencesTest.java 27 Sep 2002 12:23:28 -0000
@@ -11,12 +11,9 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.eclipse.cdt.internal.corext.template.c.ICompilationUnit;
import org.eclipse.cdt.testplugin.TestPluginLauncher;
import org.eclipse.cdt.testplugin.util.DialogCheck;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.preference.IPreferenceNode;
import org.eclipse.jface.preference.PreferenceDialog;