Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferguson2008-01-15 11:55:45 +0000
committerAndrew Ferguson2008-01-15 11:55:45 +0000
commit080fe9610336c5b1a858b8a4d2799394465cb72e (patch)
tree63b1937dc156e0ae8a42736938ed4fd19b450355
parent48ed21f9a50a88ee6e0c46a4864ff624da2a0236 (diff)
downloadorg.eclipse.cdt-080fe9610336c5b1a858b8a4d2799394465cb72e.tar.gz
org.eclipse.cdt-080fe9610336c5b1a858b8a4d2799394465cb72e.tar.xz
org.eclipse.cdt-080fe9610336c5b1a858b8a4d2799394465cb72e.zip
apply patch on behalf of Mark Espiritu (bug 215283)
-rw-r--r--core/org.eclipse.cdt.core.tests/templateengine/org/eclipse/cdt/core/tests/templateengine/AllTemplateEngineTests.java5
-rw-r--r--core/org.eclipse.cdt.core.tests/templateengine/org/eclipse/cdt/core/tests/templateengine/TestTemplateEngineBugs.java38
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessHelper.java3
3 files changed, 43 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core.tests/templateengine/org/eclipse/cdt/core/tests/templateengine/AllTemplateEngineTests.java b/core/org.eclipse.cdt.core.tests/templateengine/org/eclipse/cdt/core/tests/templateengine/AllTemplateEngineTests.java
index d588e80a747..b9e2250f3aa 100644
--- a/core/org.eclipse.cdt.core.tests/templateengine/org/eclipse/cdt/core/tests/templateengine/AllTemplateEngineTests.java
+++ b/core/org.eclipse.cdt.core.tests/templateengine/org/eclipse/cdt/core/tests/templateengine/AllTemplateEngineTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Symbian Software Limited and others.
+ * Copyright (c) 2007, 2008 Symbian Software Limited 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
@@ -31,7 +31,7 @@ public class AllTemplateEngineTests extends TestSuite {
* Since the TemplateEngine consists of UI(Wizard).
* A TestWizard is created to which the dynamically generated
* UIPages are added. The Wizard is launched from here.
- * The TestCases created to test the TemplateEngine is initialized here.
+ * The TestCases created to test the TemplateEngine is initialised here.
* @return
*
* @since 4.0
@@ -45,6 +45,7 @@ public class AllTemplateEngineTests extends TestSuite {
suite.addTestSuite(TestValueStore.class);
suite.addTestSuite(TestSharedDefaults.class);
suite.addTestSuite(TestProcesses.class);
+ suite.addTestSuite(TestTemplateEngineBugs.class);
//$JUnit-END$
return suite;
diff --git a/core/org.eclipse.cdt.core.tests/templateengine/org/eclipse/cdt/core/tests/templateengine/TestTemplateEngineBugs.java b/core/org.eclipse.cdt.core.tests/templateengine/org/eclipse/cdt/core/tests/templateengine/TestTemplateEngineBugs.java
new file mode 100644
index 00000000000..b39fbc6768b
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/templateengine/org/eclipse/cdt/core/tests/templateengine/TestTemplateEngineBugs.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Symbian Software Limited 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:
+ * Andrew Ferguson (Symbian) - Initial Implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core.tests.templateengine;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.cdt.core.templateengine.process.ProcessHelper;
+import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
+
+public class TestTemplateEngineBugs extends BaseTestCase {
+
+ public void testBug215283() {
+ assertEquals(set("a"), ProcessHelper.getReplaceKeys("$(a)"));
+ assertEquals(set("a,b"), ProcessHelper.getReplaceKeys("$(a)$(b)"));
+ assertEquals(set("a,b,cc,ddd"), ProcessHelper.getReplaceKeys("$(a)$(b)$(cc)$(ddd)"));
+ assertEquals(set("aaa,b,c,dd"), ProcessHelper.getReplaceKeys("$(aaa)$(b)$(c)$(dd)"));
+ assertEquals(set("a"), ProcessHelper.getReplaceKeys("($(a))"));
+ assertEquals(set("a,b"), ProcessHelper.getReplaceKeys("$(b)$(a)"));
+ assertEquals(set("a"), ProcessHelper.getReplaceKeys(" \n$(a)"));
+ assertEquals(set("a"), ProcessHelper.getReplaceKeys("$(a) "));
+ }
+
+ private Set set(String s) {
+ HashSet result= new HashSet();
+ result.addAll(Arrays.asList(s.split(",")));
+ return result;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessHelper.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessHelper.java
index d8d7f0d14ea..e39c387e5b5 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessHelper.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/ProcessHelper.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Bala Torati (Symbian) - Initial API and implementation
+ * Mark Espiritu (VaST Systems) - bug 215283
*******************************************************************************/
package org.eclipse.cdt.core.templateengine.process;
@@ -88,7 +89,7 @@ public class ProcessHelper {
end = str.indexOf(END_PATTERN, start);
if (end != -1) {
replaceStrings.add(str.substring(start + START_PATTERN.length(), end));
- start = end + START_PATTERN.length();
+ start = end + END_PATTERN.length();
} else
start++;
}

Back to the top