Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gvozdev2010-09-24 18:13:15 -0400
committerAndrew Gvozdev2010-09-24 18:13:15 -0400
commit8cdd50422c0f17797b02f93ff2fb238adac7a3b1 (patch)
treec28ca6d8582b8b1f18793148c2ba18f1f2f1cdc5 /xlc/org.eclipse.cdt.errorparsers.xlc.tests
parent4d3edd80a2216db9e44594bc2b001410392147f4 (diff)
downloadorg.eclipse.cdt-8cdd50422c0f17797b02f93ff2fb238adac7a3b1.tar.gz
org.eclipse.cdt-8cdd50422c0f17797b02f93ff2fb238adac7a3b1.tar.xz
org.eclipse.cdt-8cdd50422c0f17797b02f93ff2fb238adac7a3b1.zip
bug 323445: Generate cross linked message for redeclaration xlc error
Diffstat (limited to 'xlc/org.eclipse.cdt.errorparsers.xlc.tests')
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java1
-rw-r--r--xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestRedeclaration.java46
2 files changed, 47 insertions, 0 deletions
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java
index 948a405944..df4a98f677 100644
--- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/AllXlcErrorParserTests.java
@@ -33,6 +33,7 @@ public class AllXlcErrorParserTests {
suite.addTestSuite(TestCompatibility.class);
suite.addTestSuite(TestUnrecoverableError.class);
suite.addTestSuite(TestMacroRedefinition.class);
+ suite.addTestSuite(TestRedeclaration.class);
suite.addTestSuite(TestLinkerUndefinedSymbol.class);
suite.addTestSuite(TestLinkerDuplicateSymbol.class);
suite.addTestSuite(TestLinkerSevereError.class);
diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestRedeclaration.java b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestRedeclaration.java
new file mode 100644
index 0000000000..134d4a5196
--- /dev/null
+++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/src/org/eclipse/cdt/errorparsers/xlc/tests/TestRedeclaration.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 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 Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.errorparsers.xlc.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+
+public class TestRedeclaration extends TestCase {
+ /**
+ * This function tests parseLine function of the
+ * XlcErrorParser class. The second message generated by
+ * xlc compiler for symbol redeclaration problem is given as
+ * input for testing.
+ */
+ public void testparseLine()
+ {
+ XlcErrorParserTester aix = new XlcErrorParserTester();
+ // Redeclaration warning generates 2 cross-referencing messages.
+ String err_msg = "\"src/temp1.c\", line 6.6: 1506-343 (S) Redeclaration of fun differs from previous declaration on line 334 of \"include/temp1.h\".";
+ aix.parseLine(err_msg);
+ assertEquals(2, aix.getNumberOfMarkers());
+
+ assertEquals("Redeclaration of fun differs from another declaration on line 6 of \"src/temp1.c\".", aix.getMessage(0));
+ assertEquals("temp1.h", aix.getFileName(0));
+ assertEquals(334, aix.getLineNumber(0));
+ assertEquals(IMarkerGenerator.SEVERITY_INFO, aix.getSeverity(0));
+
+ assertEquals("Redeclaration of fun differs from previous declaration on line 334 of \"include/temp1.h\".", aix.getMessage(1));
+ assertEquals("temp1.c", aix.getFileName(1));
+ assertEquals(6, aix.getLineNumber(1));
+ assertEquals(IMarkerGenerator.SEVERITY_ERROR_RESOURCE, aix.getSeverity(1));
+ }
+ public TestRedeclaration( String name)
+ {
+ super(name);
+ }
+} \ No newline at end of file

Back to the top