diff options
author | Darin Wright | 2009-11-12 19:40:59 +0000 |
---|---|---|
committer | Darin Wright | 2009-11-12 19:40:59 +0000 |
commit | 0fa95669809df9a1b738e67cd443931ad5427627 (patch) | |
tree | 4b9a864b9831dc32fc95a6f3790cd1b44c14d109 /org.eclipse.debug.tests/src | |
parent | 978d8355a2516e35ead2c68eda315639bfb8c843 (diff) | |
download | eclipse.platform.debug-0fa95669809df9a1b738e67cd443931ad5427627.tar.gz eclipse.platform.debug-0fa95669809df9a1b738e67cd443931ad5427627.tar.xz eclipse.platform.debug-0fa95669809df9a1b738e67cd443931ad5427627.zip |
Bug 41353 - [launching] Launch config templates
Diffstat (limited to 'org.eclipse.debug.tests/src')
-rw-r--r-- | org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java index 455d5bd00..c9de10cba 100644 --- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java +++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java @@ -1250,6 +1250,55 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau assertTrue(t2.isTemplate()); } + /** + * Tests that a template that adds an attribute is not considered to override any template + * values. + * + * @throws CoreException + */ + public void testTemplateNoOverride() throws CoreException { + ILaunchConfigurationWorkingCopy t1 = newTemplate(null, "2-b-the-same"); + ILaunchConfiguration template = t1.doSave(); + ILaunchConfigurationWorkingCopy wc = template.getType().newInstance(null, "will-b-the-same", template); + wc.setAttribute("EXTEND-ATTRIBUTES", "EXTEND-ATTRIBUTES"); + Map dif = wc.findDifferences(template.getAttributes()); + assertTrue("Should not override any values", dif.isEmpty()); + } + + /** + * Tests that a template that changes an attribute is considered to override its template + * values. + * + * @throws CoreException + */ + public void testTemplateOverride() throws CoreException { + ILaunchConfigurationWorkingCopy t1 = newTemplate(null, "2-b-diff"); + ILaunchConfiguration template = t1.doSave(); + ILaunchConfigurationWorkingCopy wc = template.getType().newInstance(null, "will-b-diff", template); + wc.setAttribute("String1", "String2"); + Map dif = wc.findDifferences(template.getAttributes()); + assertEquals("Should override String1 value", 1, dif.size()); + assertTrue("Should override String1 value", dif.containsKey("String1")); + assertEquals("Should override String1 value with String2", "String2", dif.get("String1")); + } + + /** + * Test that a configuration that omits a template value shows the difference with + * a <code>null</code> entry in the difference map. + * + * @throws CoreException + */ + public void testMissingTemaplteValue() throws CoreException { + ILaunchConfigurationWorkingCopy t1 = newTemplate(null, "2-b-missing"); + ILaunchConfiguration template = t1.doSave(); + ILaunchConfigurationWorkingCopy wc = template.getType().newInstance(null, "will-b-diff", template); + wc.removeAttribute("String1"); + Map dif = wc.findDifferences(template.getAttributes()); + assertEquals("Should be missing String1 value", 1, dif.size()); + assertTrue("Should be missing String1 value", dif.containsKey("String1")); + assertNull("Should be null value", dif.get("String1")); + } + } |