Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHoda Amer2004-01-23 19:45:59 +0000
committerHoda Amer2004-01-23 19:45:59 +0000
commitf26c374088f367540983dba898cafbc01a3d7358 (patch)
treeeec58e4fa03a90ddf3c4dbea85ee6b32b69f99f9 /core/org.eclipse.cdt.ui.tests
parenta90de5234d56fcd48ee5127590142f008e33784d (diff)
downloadorg.eclipse.cdt-f26c374088f367540983dba898cafbc01a3d7358.tar.gz
org.eclipse.cdt-f26c374088f367540983dba898cafbc01a3d7358.tar.xz
org.eclipse.cdt-f26c374088f367540983dba898cafbc01a3d7358.zip
Content Assist Work: More JUnit tests
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/ChangeLog3
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart.h1
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart13.h (renamed from core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart3.h)0
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart14.cpp5
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart15.cpp5
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart3.cpp3
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart4.cpp3
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart5.cpp3
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart6.cpp3
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java24
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_FieldType_NoPrefix2.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_SingleName_NoPrefix.java140
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_SingleName_Prefix2.java125
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_MacroRef_NoPrefix_Bug50487.java121
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_MacroRef_Prefix_Bug50487.java119
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_NamespaceRef_NoPrefix_Bug50471.java120
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_NamespaceRef_Prefix_Bug50471.java120
17 files changed, 788 insertions, 11 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ChangeLog b/core/org.eclipse.cdt.ui.tests/ChangeLog
index 9d0846568d..5d47b247e2 100644
--- a/core/org.eclipse.cdt.ui.tests/ChangeLog
+++ b/core/org.eclipse.cdt.ui.tests/ChangeLog
@@ -1,3 +1,6 @@
+2004-01-23 Hoda Amer
+ More Completion JUnit tests.
+
2004-01-22 John Camelon
Updated CompletionFailedTest_FieldType_NoPrefix_Bug50344 and moved from failed tests.
diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart.h b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart.h
index 50004a771f..df667d08a7 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart.h
+++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart.h
@@ -1,3 +1,4 @@
+#define DEBUG 1
#define AMacro(x) x+1
#define XMacro(x,y) x+y
diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart3.h b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart13.h
index b41aa044f5..b41aa044f5 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart3.h
+++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart13.h
diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart14.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart14.cpp
new file mode 100644
index 0000000000..5d33709a5a
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart14.cpp
@@ -0,0 +1,5 @@
+#include "CompletionTestStart.h"
+
+void foo(int x){
+ int y = a
+}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart15.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart15.cpp
new file mode 100644
index 0000000000..238e95c0f8
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart15.cpp
@@ -0,0 +1,5 @@
+#include "CompletionTestStart.h"
+
+void foo(int x){
+ int y =
+}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart3.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart3.cpp
new file mode 100644
index 0000000000..1af4d33b20
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart3.cpp
@@ -0,0 +1,3 @@
+#include "CompletionTestStart.h"
+
+using
diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart4.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart4.cpp
new file mode 100644
index 0000000000..6f1f93e398
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart4.cpp
@@ -0,0 +1,3 @@
+#include "CompletionTestStart.h"
+
+using a
diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart5.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart5.cpp
new file mode 100644
index 0000000000..5a09fa91ec
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart5.cpp
@@ -0,0 +1,3 @@
+#include "CompletionTestStart.h"
+
+#ifdef
diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart6.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart6.cpp
new file mode 100644
index 0000000000..4f474a2883
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/failedtests/CompletionFailedTestStart6.cpp
@@ -0,0 +1,3 @@
+#include "CompletionTestStart.h"
+
+#ifdef D
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java
index 4953e24162..7513c78599 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java
@@ -36,24 +36,30 @@ public class AutomatedSuite extends TestSuite {
// Success Tests
addTest(PartitionTokenScannerTest.suite());
addTest(TextBufferTest.suite());
- addTest(CompletionTest_StatementStart_Prefix.suite());
- addTest(CompletionTest_MemberReference_Dot_Prefix.suite());
- addTest(CompletionTest_VariableType_Prefix.suite());
+ // completion tests
addTest(CompletionTest_FieldType_Prefix.suite());
+ addTest(CompletionTest_FieldType_NoPrefix.suite());
+ addTest(CompletionTest_FieldType_NoPrefix2.suite());
+ addTest(CompletionTest_VariableType_Prefix.suite());
+ addTest(CompletionTest_VariableType_NoPrefix.suite());
+ addTest(CompletionTest_StatementStart_Prefix.suite());
addTest(CompletionTest_StatementStart_NoPrefix.suite());
- addTest(CompletionTest_MemberReference_Arrow_Prefix.suite());
- addTest(CompletionTest_MemberReference_Arrow_Prefix2.suite());
addTest(CompletionTest_SingleName_Prefix.suite());
+ addTest(CompletionTest_SingleName_Prefix2.suite());
+ addTest(CompletionTest_SingleName_NoPrefix.suite());
+ addTest(CompletionTest_MemberReference_Dot_Prefix.suite());
addTest(CompletionTest_MemberReference_Dot_NoPrefix.suite());
+ addTest(CompletionTest_MemberReference_Arrow_Prefix.suite());
+ addTest(CompletionTest_MemberReference_Arrow_Prefix2.suite());
addTest(CompletionTest_MemberReference_Arrow_NoPrefix.suite());
- addTest(CompletionTest_VariableType_NoPrefix.suite());
- addTest(CompletionTest_FieldType_NoPrefix.suite());
// Failed Tests
addTest(CompletionFailedTest_ScopedReference_NoPrefix_Bug50152.suite());
addTest(CompletionFailedTest_ScopedReference_Prefix_Bug50152.suite());
- addTest(CompletionTest_FieldType_NoPrefix2.suite());
-
+ addTest(CompletionFailedTest_NamespaceRef_NoPrefix_Bug50471.suite());
+ addTest(CompletionFailedTest_NamespaceRef_Prefix_Bug50471.suite());
+ addTest(CompletionFailedTest_MacroRef_NoPrefix_Bug50487.suite());
+ addTest(CompletionFailedTest_MacroRef_Prefix_Bug50487.suite());
}
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_FieldType_NoPrefix2.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_FieldType_NoPrefix2.java
index 97a66338bc..1cd33ada2d 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_FieldType_NoPrefix2.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_FieldType_NoPrefix2.java
@@ -23,8 +23,8 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
*/
public class CompletionTest_FieldType_NoPrefix2 extends CompletionProposalsBaseTest{
- private final String fileName = "CompletionFailedTestStart3.h";
- private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
+ 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 expectedScopeName = "ASTClassSpecifier";
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_SingleName_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_SingleName_NoPrefix.java
new file mode 100644
index 0000000000..6510ab9574
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_SingleName_NoPrefix.java
@@ -0,0 +1,140 @@
+/**********************************************************************
+ * Copyright (c) 2004 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.ui.tests.text.contentassist;
+
+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 expectedScopeName = "ASTFunction";
+ private final String expectedContextName = "null";
+ private final CompletionKind expectedKind = CompletionKind.SINGLE_NAME_REFERENCE;
+ 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",
+ "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#getExpectedScope()
+ */
+ protected String getExpectedScopeClassName() {
+ return expectedScopeName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
+ */
+ protected String getExpectedContextClassName() {
+ return expectedContextName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
+ */
+ protected CompletionKind getExpectedKind() {
+ return expectedKind;
+ }
+
+ /* (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/contentassist/CompletionTest_SingleName_Prefix2.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_SingleName_Prefix2.java
new file mode 100644
index 0000000000..e1bc0aca7e
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/CompletionTest_SingleName_Prefix2.java
@@ -0,0 +1,125 @@
+/**********************************************************************
+ * Copyright (c) 2004 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.ui.tests.text.contentassist;
+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_Prefix2 extends CompletionProposalsBaseTest{
+ private final String fileName = "CompletionTestStart14.cpp";
+ private final String fileFullPath ="resources/contentassist/" + fileName;
+ private final String headerFileName = "CompletionTestStart.h";
+ private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
+ private final String expectedScopeName = "ASTFunction";
+ private final String expectedContextName = "null";
+ private final CompletionKind expectedKind = CompletionKind.SINGLE_NAME_REFERENCE;
+ private final String expectedPrefix = "a";
+ private final String[] expectedResults = {
+ "aVariable : int",
+ "aFunction() bool",
+ "anotherFunction() void",
+ "aClass",
+ "anotherClass",
+ "aNamespace",
+ "anEnumeration",
+ "aFirstEnum",
+ "aSecondEnum",
+ "aThirdEnum",
+ "AStruct",
+ "AMacro(x)"
+ };
+
+ public CompletionTest_SingleName_Prefix2(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite= new TestSuite(CompletionTest_SingleName_Prefix2.class.getName());
+ suite.addTest(new CompletionTest_SingleName_Prefix2("testCompletionProposals"));
+ return suite;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
+ */
+ protected int getCompletionPosition() {
+ return getBuffer().indexOf(" a ") + 2;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
+ */
+ protected String getExpectedScopeClassName() {
+ return expectedScopeName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
+ */
+ protected String getExpectedContextClassName() {
+ return expectedContextName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
+ */
+ protected CompletionKind getExpectedKind() {
+ return expectedKind;
+ }
+
+ /* (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/contentassist/failedtests/CompletionFailedTest_MacroRef_NoPrefix_Bug50487.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_MacroRef_NoPrefix_Bug50487.java
new file mode 100644
index 0000000000..2b8491af7b
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_MacroRef_NoPrefix_Bug50487.java
@@ -0,0 +1,121 @@
+/**********************************************************************
+ * Copyright (c) 2004 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
+import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
+
+/**
+ * @author hamer
+ *
+ * Testing Macro_Reference, with no prefix
+ * Bug#50487 :Wrong completion kind and prefix after "#ifdef"
+ *
+ */
+public class CompletionFailedTest_MacroRef_NoPrefix_Bug50487 extends CompletionProposalsBaseTest{
+
+ private final String fileName = "CompletionFailedTestStart5.cpp";
+ private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
+ private final String headerFileName = "CompletionTestStart.h";
+ private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
+ private final String expectedScopeName = "ASTCompilationUnit";
+ private final String expectedContextName = "null";
+ private final CompletionKind expectedKind = CompletionKind.VARIABLE_TYPE; // should be CompletionKind.MACRO_REFERENCE;
+ private final String expectedPrefix = "";
+ private final String[] expectedResults = {
+// Should be
+// "aMacro(x)",
+// "Debug",
+// "xMacro(x,y)"
+ };
+
+ public CompletionFailedTest_MacroRef_NoPrefix_Bug50487(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite= new TestSuite(CompletionFailedTest_MacroRef_NoPrefix_Bug50487.class.getName());
+ suite.addTest(new CompletionFailedTest_MacroRef_NoPrefix_Bug50487("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#getExpectedScope()
+ */
+ protected String getExpectedScopeClassName() {
+ return expectedScopeName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
+ */
+ protected String getExpectedContextClassName() {
+ return expectedContextName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
+ */
+ protected CompletionKind getExpectedKind() {
+ return expectedKind;
+ }
+
+ /* (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/contentassist/failedtests/CompletionFailedTest_MacroRef_Prefix_Bug50487.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_MacroRef_Prefix_Bug50487.java
new file mode 100644
index 0000000000..5ac2ad6e2d
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_MacroRef_Prefix_Bug50487.java
@@ -0,0 +1,119 @@
+/**********************************************************************
+ * Copyright (c) 2004 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
+import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
+
+/**
+ * @author hamer
+ *
+ * Testing Macro_Reference, with no prefix
+ * Bug#50487 :Wrong completion kind and prefix after "#ifdef"
+ *
+ */
+public class CompletionFailedTest_MacroRef_Prefix_Bug50487 extends CompletionProposalsBaseTest{
+
+ private final String fileName = "CompletionFailedTestStart6.cpp";
+ private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
+ private final String headerFileName = "CompletionTestStart.h";
+ private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
+ private final String expectedScopeName = "ASTCompilationUnit";
+ private final String expectedContextName = "null";
+ private final CompletionKind expectedKind = CompletionKind.VARIABLE_TYPE; // should be CompletionKind.MACRO_REFERENCE;
+ private final String expectedPrefix = ""; // should be "D";
+ private final String[] expectedResults = {
+// Should be
+// "Debug"
+ };
+
+ public CompletionFailedTest_MacroRef_Prefix_Bug50487(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite= new TestSuite(CompletionFailedTest_MacroRef_Prefix_Bug50487.class.getName());
+ suite.addTest(new CompletionFailedTest_MacroRef_Prefix_Bug50487("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#getExpectedScope()
+ */
+ protected String getExpectedScopeClassName() {
+ return expectedScopeName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
+ */
+ protected String getExpectedContextClassName() {
+ return expectedContextName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
+ */
+ protected CompletionKind getExpectedKind() {
+ return expectedKind;
+ }
+
+ /* (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/contentassist/failedtests/CompletionFailedTest_NamespaceRef_NoPrefix_Bug50471.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_NamespaceRef_NoPrefix_Bug50471.java
new file mode 100644
index 0000000000..4a1a30f537
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_NamespaceRef_NoPrefix_Bug50471.java
@@ -0,0 +1,120 @@
+/**********************************************************************
+ * Copyright (c) 2004 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
+import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
+
+/**
+ * @author hamer
+ *
+ * Testing Namespace_Reference, with no prefix
+ * Bug#50471 : Wrong completion kind after the "using" keyword
+ *
+ */
+public class CompletionFailedTest_NamespaceRef_NoPrefix_Bug50471 extends CompletionProposalsBaseTest{
+
+ private final String fileName = "CompletionFailedTestStart3.cpp";
+ private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
+ private final String headerFileName = "CompletionTestStart.h";
+ private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
+ private final String expectedScopeName = "ASTCompilationUnit";
+ private final String expectedContextName = "null";
+ private final CompletionKind expectedKind = CompletionKind.VARIABLE_TYPE; // should be CompletionKind.NAMESPACE_REFERENCE;
+ private final String expectedPrefix = "";
+ private final String[] expectedResults = {
+// Should be
+// "aNamespace",
+// "xNamespace"
+ };
+
+ public CompletionFailedTest_NamespaceRef_NoPrefix_Bug50471(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite= new TestSuite(CompletionFailedTest_NamespaceRef_NoPrefix_Bug50471.class.getName());
+ suite.addTest(new CompletionFailedTest_NamespaceRef_NoPrefix_Bug50471("testCompletionProposals"));
+ return suite;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
+ */
+ protected int getCompletionPosition() {
+ return getBuffer().indexOf("using ") + 6;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
+ */
+ protected String getExpectedScopeClassName() {
+ return expectedScopeName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
+ */
+ protected String getExpectedContextClassName() {
+ return expectedContextName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
+ */
+ protected CompletionKind getExpectedKind() {
+ return expectedKind;
+ }
+
+ /* (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/contentassist/failedtests/CompletionFailedTest_NamespaceRef_Prefix_Bug50471.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_NamespaceRef_Prefix_Bug50471.java
new file mode 100644
index 0000000000..90d404d2ec
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/failedtests/CompletionFailedTest_NamespaceRef_Prefix_Bug50471.java
@@ -0,0 +1,120 @@
+/**********************************************************************
+ * Copyright (c) 2004 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
+import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
+
+/**
+ * @author hamer
+ *
+ * Testing Namespace_Reference, with prefix
+ * Bug#50471 : Wrong completion kind after the "using" keyword
+ *
+ */
+public class CompletionFailedTest_NamespaceRef_Prefix_Bug50471 extends CompletionProposalsBaseTest{
+
+ private final String fileName = "CompletionFailedTestStart4.cpp";
+ private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
+ private final String headerFileName = "CompletionTestStart.h";
+ private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
+ private final String expectedScopeName = "ASTCompilationUnit";
+ private final String expectedContextName = "null";
+ private final CompletionKind expectedKind = CompletionKind.VARIABLE_TYPE; // should be CompletionKind.NAMESPACE_REFERENCE;
+ private final String expectedPrefix = "a";
+ private final String[] expectedResults = {
+// Should be
+// "aNamespace"
+ };
+
+ public CompletionFailedTest_NamespaceRef_Prefix_Bug50471(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite= new TestSuite(CompletionFailedTest_NamespaceRef_Prefix_Bug50471.class.getName());
+ suite.addTest(new CompletionFailedTest_NamespaceRef_Prefix_Bug50471("testCompletionProposals"));
+ return suite;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
+ */
+ protected int getCompletionPosition() {
+ return getBuffer().indexOf("using a ") + 7;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
+ */
+ protected String getExpectedScopeClassName() {
+ return expectedScopeName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
+ */
+ protected String getExpectedContextClassName() {
+ return expectedContextName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
+ */
+ protected CompletionKind getExpectedKind() {
+ return expectedKind;
+ }
+
+ /* (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;
+ }
+
+}

Back to the top