1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix JUnit tests

This commit is contained in:
Anton Leherbauer 2008-05-05 14:40:34 +00:00
parent 518b582cd0
commit 36b57b7212
4 changed files with 24 additions and 21 deletions

View file

@ -80,10 +80,12 @@ public class BasicCEditorTest extends BaseUITestCase {
return new TestSuite(BasicCEditorTest.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Override
protected void tearDown () throws Exception {
EditorTestHelper.closeEditor(fEditor);
if (fCProject != null)
@ -185,6 +187,7 @@ public class BasicCEditorTest extends BaseUITestCase {
// return 0;
// }
//}
//
public void testEditNewTranslationUnit() throws Exception {
fCProject= EditorTestHelper.createCProject("ceditor", "resources/ceditor", false, false);
IFile newFile= createFile(fCProject.getProject(), "Point.cpp", "");
@ -222,7 +225,7 @@ public class BasicCEditorTest extends BaseUITestCase {
setUpEditor(newFile);
fSourceViewer= EditorTestHelper.getSourceViewer(fEditor);
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
content= fDocument.get();
content= fDocument.get().trim();
assertEquals("Save failed", newContent, content);
// check reconciler
ITranslationUnit tUnit= (ITranslationUnit)fEditor.getInputCElement();
@ -352,6 +355,7 @@ public class BasicCEditorTest extends BaseUITestCase {
fAccessor.invoke("handleKeyDown", new Object[] {event});
new DisplayHelper() {
@Override
protected boolean condition() {
return fDocListener.fDocChanged;
}

View file

@ -17,7 +17,6 @@ import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
@ -89,6 +88,7 @@ public class DocCommentHighlightingTest extends BaseUITestCase {
super(name);
}
@Override
protected void setUp() throws Exception {
super.setUp();
fCProject= EditorTestHelper.createCProject(PROJECT, LINKED_FOLDER);
@ -97,10 +97,10 @@ public class DocCommentHighlightingTest extends BaseUITestCase {
fSourceViewer= EditorTestHelper.getSourceViewer(fEditor);
// source positions depend on Windows line separator
adjustLineSeparator(fSourceViewer.getDocument(), "\r\n");
fEditor.doSave(new NullProgressMonitor());
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
}
@Override
protected void tearDown () throws Exception {
EditorTestHelper.closeAllEditors();

View file

@ -83,9 +83,8 @@ public class KeywordCompletionProposalComputer extends ParsingBasedProposalCompu
Image image = imagedesc != null ? CUIPlugin.getImageDescriptorRegistry().get(imagedesc) : null;
for(String keyword : languageKeywords.getPreprocessorKeywords()) {
keyword = keyword + ' ';
String repString = keyword;
if (repString.startsWith(prefix) && keyword.length() > prefixLength) {
if (keyword.startsWith(prefix) && keyword.length() > prefixLength) {
String repString = keyword + ' ';
int repLength = prefixLength;
int repOffset = context.getInvocationOffset() - repLength;
if (prefix.charAt(0) == '#') {