diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_NoPrefix.java new file mode 100644 index 00000000000..813dc62809b --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_NoPrefix.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; + + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; + +/** + * @author hamer + * + * Testing Argument_Type completion kind , with No prefix + * Bug#50642 : Wrong completion kind when declaring an argument type + * + */ +public class CompletionTest_ArgumentType_NoPrefix extends CompletionProposalsBaseTest{ + private final String fileName = "CompletionTestStart17.cpp"; + private final String fileFullPath ="resources/contentassist/" + fileName; + private final String headerFileName = "CompletionTestStart.h"; + private final String headerFileFullPath ="resources/contentassist/" + headerFileName; + private final String expectedPrefix = ""; + private final String[] expectedResults = { + }; + + public CompletionTest_ArgumentType_NoPrefix(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite= new TestSuite(CompletionTest_ArgumentType_NoPrefix.class.getName()); + suite.addTest(new CompletionTest_ArgumentType_NoPrefix("testCompletionProposals")); + return suite; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() + */ + protected int getCompletionPosition() { + return getBuffer().indexOf(" ") + 2; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() + */ + protected String getExpectedPrefix() { + return expectedPrefix; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() + */ + protected String[] getExpectedResultsValues() { + return expectedResults; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() + */ + protected String getFileName() { + return fileName; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() + */ + protected String getFileFullPath() { + return fileFullPath; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() + */ + protected String getHeaderFileFullPath() { + return headerFileFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() + */ + protected String getHeaderFileName() { + return headerFileName; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_NoPrefix2.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_NoPrefix2.java new file mode 100644 index 00000000000..19e05d1d7fc --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_NoPrefix2.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; + +/** + * @author hamer + * + * Testing Argument_Type completion kind , with No prefix + * Bug#50642 : Wrong completion kind when declaring an argument type + * + */ +public class CompletionTest_ArgumentType_NoPrefix2 extends CompletionProposalsBaseTest{ + private final String fileName = "CompletionTestStart19.cpp"; + private final String fileFullPath ="resources/contentassist/" + fileName; + private final String headerFileName = "CompletionTestStart.h"; + private final String headerFileFullPath ="resources/contentassist/" + headerFileName; + private final String expectedPrefix = ""; + private final String[] expectedResults = { + }; + + public CompletionTest_ArgumentType_NoPrefix2(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite= new TestSuite(CompletionTest_ArgumentType_NoPrefix2.class.getName()); + suite.addTest(new CompletionTest_ArgumentType_NoPrefix2("testCompletionProposals")); + return suite; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() + */ + protected int getCompletionPosition() { + return getBuffer().indexOf(" ") + 2; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() + */ + protected String getExpectedPrefix() { + return expectedPrefix; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() + */ + protected String[] getExpectedResultsValues() { + return expectedResults; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() + */ + protected String getFileName() { + return fileName; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() + */ + protected String getFileFullPath() { + return fileFullPath; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() + */ + protected String getHeaderFileFullPath() { + return headerFileFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() + */ + protected String getHeaderFileName() { + return headerFileName; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ClassReference_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ClassReference_NoPrefix.java new file mode 100644 index 00000000000..d33847922a3 --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ClassReference_NoPrefix.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; + +/** + * @author hamer + * + * Testing Class_Reference, with No prefix + * Bug#50621 :Wrong completion kind in a class declaration + * + */ +public class CompletionTest_ClassReference_NoPrefix extends CompletionProposalsBaseTest{ + + private final String fileName = "CompletionTestStart21.h"; + private final String fileFullPath ="resources/contentassist/" + fileName; + private final String headerFileName = "CompletionTestStart.h"; + private final String headerFileFullPath ="resources/contentassist/" + headerFileName; + private final String expectedPrefix = ""; + private final String[] expectedResults = { + "aClass", + "anotherClass", + "ClassA", + "xOtherClass" + }; + + public CompletionTest_ClassReference_NoPrefix(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite= new TestSuite(CompletionTest_ClassReference_NoPrefix.class.getName()); + suite.addTest(new CompletionTest_ClassReference_NoPrefix("testCompletionProposals")); + return suite; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() + */ + protected int getCompletionPosition() { + return getBuffer().indexOf(" ") + 2; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() + */ + protected String getExpectedPrefix() { + return expectedPrefix; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() + */ + protected String[] getExpectedResultsValues() { + return expectedResults; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() + */ + protected String getFileName() { + return fileName; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() + */ + protected String getFileFullPath() { + return fileFullPath; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() + */ + protected String getHeaderFileFullPath() { + return headerFileFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() + */ + protected String getHeaderFileName() { + return headerFileName; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ExceptionReference_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ExceptionReference_NoPrefix.java new file mode 100644 index 00000000000..00fdffdc78e --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ExceptionReference_NoPrefix.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; + + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; + +/** + * @author hamer + * + * Testing Exception_Reference, with No prefix + * Bug#50640 : Wrong completion kind when expecting an exception + * + */ +public class CompletionTest_ExceptionReference_NoPrefix extends CompletionProposalsBaseTest{ + + private final String fileName = "CompletionTestStart23.cpp"; + private final String fileFullPath ="resources/contentassist/" + fileName; + private final String headerFileName = "CompletionTestStart.h"; + private final String headerFileFullPath ="resources/contentassist/" + headerFileName; + private final String expectedPrefix = ""; + private final String[] expectedResults = { + "..." + }; + + public CompletionTest_ExceptionReference_NoPrefix(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite= new TestSuite(CompletionTest_ExceptionReference_NoPrefix.class.getName()); + suite.addTest(new CompletionTest_ExceptionReference_NoPrefix("testCompletionProposals")); + return suite; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() + */ + protected int getCompletionPosition() { + return getBuffer().indexOf(" ") + 2; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() + */ + protected String getExpectedPrefix() { + return expectedPrefix; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() + */ + protected String[] getExpectedResultsValues() { + return expectedResults; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() + */ + protected String getFileName() { + return fileName; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() + */ + protected String getFileFullPath() { + return fileFullPath; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() + */ + protected String getHeaderFileFullPath() { + return headerFileFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() + */ + protected String getHeaderFileName() { + return headerFileName; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FieldType_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FieldType_NoPrefix.java new file mode 100644 index 00000000000..4b98bc5fee4 --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FieldType_NoPrefix.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; + +/** + * @author hamer + * + * Testing Field_Type, with NO prefix + * + */ +public class CompletionTest_FieldType_NoPrefix extends CompletionProposalsBaseTest{ + private final String fileName = "CompletionTestStart12.h"; + private final String fileFullPath ="resources/contentassist/" + fileName; + private final String headerFileName = "CompletionTestStart.h"; + private final String headerFileFullPath ="resources/contentassist/" + headerFileName; + private final String expectedPrefix = ""; + private final String[] expectedResults = { + }; + + public CompletionTest_FieldType_NoPrefix(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite= new TestSuite(CompletionTest_FieldType_NoPrefix.class.getName()); + suite.addTest(new CompletionTest_FieldType_NoPrefix("testCompletionProposals")); + return suite; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() + */ + protected int getCompletionPosition() { + return getBuffer().indexOf(" ") + 2; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() + */ + protected String getExpectedPrefix() { + return expectedPrefix; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() + */ + protected String[] getExpectedResultsValues() { + return expectedResults; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() + */ + protected String getFileName() { + return fileName; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() + */ + protected String getFileFullPath() { + return fileFullPath; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() + */ + protected String getHeaderFileFullPath() { + return headerFileFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() + */ + protected String getHeaderFileName() { + return headerFileName; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FieldType_NoPrefix2.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FieldType_NoPrefix2.java new file mode 100644 index 00000000000..6c43e4f8700 --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FieldType_NoPrefix2.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; + +/** + * @author hamer + * + * Testing Class scope, declaration start, with NO prefix + * Bug#50344 :Wrong completion in Class scope if before the first declaration + * + */ +public class CompletionTest_FieldType_NoPrefix2 extends CompletionProposalsBaseTest{ + + private final String fileName = "CompletionTestStart13.h"; + private final String fileFullPath ="resources/contentassist/" + fileName; + private final String headerFileName = "CompletionTestStart.h"; + private final String headerFileFullPath ="resources/contentassist/" + headerFileName; + private final String expectedPrefix = ""; + private final String[] expectedResults = { + }; + + public CompletionTest_FieldType_NoPrefix2(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite= new TestSuite(CompletionTest_FieldType_NoPrefix2.class.getName()); + suite.addTest(new CompletionTest_FieldType_NoPrefix2("testCompletionProposals")); + return suite; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() + */ + protected int getCompletionPosition() { + return getBuffer().indexOf(" ") + 3; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() + */ + protected String getExpectedPrefix() { + return expectedPrefix; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() + */ + protected String[] getExpectedResultsValues() { + return expectedResults; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() + */ + protected String getFileName() { + return fileName; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() + */ + protected String getFileFullPath() { + return fileFullPath; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() + */ + protected String getHeaderFileFullPath() { + return headerFileFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() + */ + protected String getHeaderFileName() { + return headerFileName; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MacroRef_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MacroRef_NoPrefix.java new file mode 100644 index 00000000000..2c9de02a6ce --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MacroRef_NoPrefix.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; + +/** + * @author hamer + * + * Testing Macro_Reference, with no prefix + * Bug#50487 :Wrong completion kind and prefix after "#ifdef" + * + */ +public class CompletionTest_MacroRef_NoPrefix extends CompletionProposalsBaseTest{ + + private final String fileName = "CompletionTestStart26.cpp"; + private final String fileFullPath ="resources/contentassist/" + fileName; + private final String headerFileName = "CompletionTestStart.h"; + private final String headerFileFullPath ="resources/contentassist/" + headerFileName; + private final String expectedPrefix = ""; + private final String[] expectedResults = { +// Should be +// "aMacro(x)", +// "Debug", +// "xMacro(x,y)" + }; + + public CompletionTest_MacroRef_NoPrefix(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite= new TestSuite(CompletionTest_MacroRef_NoPrefix.class.getName()); + suite.addTest(new CompletionTest_MacroRef_NoPrefix("testCompletionProposals")); + return suite; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() + */ + protected int getCompletionPosition() { + return getBuffer().indexOf("#ifdef ") + 7; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() + */ + protected String getExpectedPrefix() { + return expectedPrefix; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() + */ + protected String[] getExpectedResultsValues() { + return expectedResults; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() + */ + protected String getFileName() { + return fileName; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() + */ + protected String getFileFullPath() { + return fileFullPath; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() + */ + protected String getHeaderFileFullPath() { + return headerFileFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() + */ + protected String getHeaderFileName() { + return headerFileName; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MacroRef_Prefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MacroRef_Prefix.java new file mode 100644 index 00000000000..241746409c3 --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MacroRef_Prefix.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; + +/** + * @author hamer + * + * Testing Macro_Reference, with no prefix + * Bug#50487 :Wrong completion kind and prefix after "#ifdef" + * + */ +public class CompletionTest_MacroRef_Prefix extends CompletionProposalsBaseTest{ + + private final String fileName = "CompletionTestStart27.cpp"; + private final String fileFullPath ="resources/contentassist/" + fileName; + private final String headerFileName = "CompletionTestStart.h"; + private final String headerFileFullPath ="resources/contentassist/" + headerFileName; + private final String expectedPrefix = "D"; + private final String[] expectedResults = { +// Should be +// "Debug" + }; + + public CompletionTest_MacroRef_Prefix(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite= new TestSuite(CompletionTest_MacroRef_Prefix.class.getName()); + suite.addTest(new CompletionTest_MacroRef_Prefix("testCompletionProposals")); + return suite; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() + */ + protected int getCompletionPosition() { + return getBuffer().indexOf("ifdef D ") + 7; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() + */ + protected String getExpectedPrefix() { + return expectedPrefix; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() + */ + protected String[] getExpectedResultsValues() { + return expectedResults; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() + */ + protected String getFileName() { + return fileName; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() + */ + protected String getFileFullPath() { + return fileFullPath; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() + */ + protected String getHeaderFileFullPath() { + return headerFileFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() + */ + protected String getHeaderFileName() { + return headerFileName; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_NoPrefix.java new file mode 100644 index 00000000000..0f73197c063 --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_NoPrefix.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; + +/** + * @author hamer + * + * Testing statement start, with no prefix + * Lookup.THIS + * + */ +public class CompletionTest_SingleName_Method_NoPrefix extends CompletionProposalsBaseTest{ + private final String fileName = "CompletionTestStart5.cpp"; + private final String fileFullPath ="resources/contentassist/" + fileName; + private final String headerFileName = "CompletionTestStart.h"; + private final String headerFileFullPath ="resources/contentassist/" + headerFileName; + private final String expectedPrefix = ""; + + //TODO Hoda - please update this constant with what it is supposed to be + private final String[] expectedResults = { + "anotherField : int", + "anotherMethod() void" + }; + + public CompletionTest_SingleName_Method_NoPrefix(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite= new TestSuite(CompletionTest_SingleName_Method_NoPrefix.class.getName()); + suite.addTest(new CompletionTest_SingleName_Method_NoPrefix("testCompletionProposals")); + return suite; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() + */ + protected int getCompletionPosition() { + return getBuffer().indexOf(" ") + 2; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() + */ + protected String getExpectedPrefix() { + return expectedPrefix; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() + */ + protected String[] getExpectedResultsValues() { + return expectedResults; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() + */ + protected String getFileName() { + return fileName; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() + */ + protected String getFileFullPath() { + return fileFullPath; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() + */ + protected String getHeaderFileFullPath() { + return headerFileFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() + */ + protected String getHeaderFileName() { + return headerFileName; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_NoPrefix.java new file mode 100644 index 00000000000..4b88e92334d --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_NoPrefix.java @@ -0,0 +1,124 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; + +/** + * @author hamer + * + * Testing Single name reference, with prefix + * + */ +public class CompletionTest_SingleName_NoPrefix extends CompletionProposalsBaseTest{ + private final String fileName = "CompletionTestStart15.cpp"; + private final String fileFullPath ="resources/contentassist/" + fileName; + private final String headerFileName = "CompletionTestStart.h"; + private final String headerFileFullPath ="resources/contentassist/" + headerFileName; + private final String expectedPrefix = ""; + private final String[] expectedResults = { + "x : int" +// "aVariable : int", +// "xVariable : int", +// "aFunction() bool", +// "anotherFunction() void", +// "foo(int) void", +// "xFunction() bool", +// "xOtherFunction() void", +// "aClass", +// "anotherClass", +// "xOtherClass", +// "AStruct", +// "XStruct", +// "aNamespace", +// "xNamespace", +// "anEnumeration", +// "xEnumeration", +// "aFirstEnum", +// "aSecondEnum", +// "aThirdEnum", +// "xFirstEnum", +// "xSecondEnum", +// "xThirdEnum", +// "__cplusplus", +// "__DATE__", +// "__FILE__", +// "__LINE__", +// "__STDC__", +// "__STDC_HOSTED__", +// "__STDC_VERSION__", +// "__TIME__", +// "AMacro(x)", +// "DEBUG", +// "XMacro(x,y)" + }; + + public CompletionTest_SingleName_NoPrefix(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite= new TestSuite(CompletionTest_SingleName_NoPrefix.class.getName()); + suite.addTest(new CompletionTest_SingleName_NoPrefix("testCompletionProposals")); + return suite; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() + */ + protected int getCompletionPosition() { + return getBuffer().indexOf(" ") + 2; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() + */ + protected String getExpectedPrefix() { + return expectedPrefix; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() + */ + protected String[] getExpectedResultsValues() { + return expectedResults; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() + */ + protected String getFileName() { + return fileName; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() + */ + protected String getFileFullPath() { + return fileFullPath; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() + */ + protected String getHeaderFileFullPath() { + return headerFileFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() + */ + protected String getHeaderFileName() { + return headerFileName; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_NoPrefix.java new file mode 100644 index 00000000000..ea9a65de90d --- /dev/null +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_NoPrefix.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Rational Software - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind; + +/** + * @author hamer + * + * Testing Variable_type, with NO prefix + * + */ +public class CompletionTest_VariableType_NoPrefix extends CompletionProposalsBaseTest{ + private final String fileName = "CompletionTestStart11.cpp"; + private final String fileFullPath ="resources/contentassist/" + fileName; + private final String headerFileName = "CompletionTestStart.h"; + private final String headerFileFullPath ="resources/contentassist/" + headerFileName; + private final String expectedPrefix = ""; + private final String[] expectedResults = { + }; + + public CompletionTest_VariableType_NoPrefix(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite= new TestSuite(CompletionTest_VariableType_NoPrefix.class.getName()); + suite.addTest(new CompletionTest_VariableType_NoPrefix("testCompletionProposals")); + return suite; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition() + */ + protected int getCompletionPosition() { + return getBuffer().indexOf(" ") + 2; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix() + */ + protected String getExpectedPrefix() { + return expectedPrefix; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues() + */ + protected String[] getExpectedResultsValues() { + return expectedResults; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName() + */ + protected String getFileName() { + return fileName; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath() + */ + protected String getFileFullPath() { + return fileFullPath; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath() + */ + protected String getHeaderFileFullPath() { + return headerFileFullPath; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName() + */ + protected String getHeaderFileName() { + return headerFileName; + } + +}