diff options
author | Anton Leherbauer | 2009-04-03 08:59:26 +0000 |
---|---|---|
committer | Anton Leherbauer | 2009-04-03 08:59:26 +0000 |
commit | 8ec06ddba35120b1795d36b8743771927c8df847 (patch) | |
tree | e7d96c332666f1325828862ebff0640b2ed81ef9 /core/org.eclipse.cdt.ui.tests | |
parent | 82162abb0119524f53e94d0a398e86f42627f0c9 (diff) | |
download | org.eclipse.cdt-8ec06ddba35120b1795d36b8743771927c8df847.tar.gz org.eclipse.cdt-8ec06ddba35120b1795d36b8743771927c8df847.tar.xz org.eclipse.cdt-8ec06ddba35120b1795d36b8743771927c8df847.zip |
Bug 270916 - Automatically close of quotes in preprocessor directives does not work
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r-- | core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/BracketInserterTest.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/BracketInserterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/BracketInserterTest.java index 267c7863d15..dcaaadaa1ab 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/BracketInserterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/BracketInserterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2009 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 @@ -91,6 +91,7 @@ public class BracketInserterTest extends TestCase { private Accessor fAccessor; private ICProject fProject; + @Override protected void setUp() throws Exception { IPreferenceStore store= CUIPlugin.getDefault().getPreferenceStore(); store.setValue(PreferenceConstants.EDITOR_CLOSE_BRACKETS, true); @@ -128,6 +129,7 @@ public class BracketInserterTest extends TestCase { } } + @Override protected void tearDown() throws Exception { EditorTestHelper.closeEditor(fEditor); fEditor= null; @@ -296,6 +298,18 @@ public class BracketInserterTest extends TestCase { assertSingleLinkedPosition(BODY_OFFSET + 1); } + // bug 270916 + public void testInsertClosingQuoteInMacroDefinition() throws BadLocationException, CModelException, CoreException { + setCaret(BODY_OFFSET); + type("#define MACRO "); + int offset = getCaret(); + type('"'); + + assertEquals("\"\"", fDocument.get(offset, 2)); + + assertSingleLinkedPosition(offset + 1); + } + public void testPreferences() throws BadLocationException, CModelException, CoreException { IPreferenceStore store= CUIPlugin.getDefault().getPreferenceStore(); store.setValue(PreferenceConstants.EDITOR_CLOSE_BRACKETS, false); @@ -336,6 +350,14 @@ public class BracketInserterTest extends TestCase { assertSingleLinkedPosition(INCLUDE_OFFSET + 1); } + public void testInsertClosingQuoteInInclude() throws Exception { + setCaret(INCLUDE_OFFSET); + type('"'); + + assertEquals("#include \"\"", fDocument.get(INCLUDE_OFFSET - 9, 11)); + assertSingleLinkedPosition(INCLUDE_OFFSET + 1); + } + public void testAngleBrackets_165837() throws Exception { setCaret(BODY_OFFSET); type("cout << \n\"aaa\" "); @@ -419,6 +441,7 @@ public class BracketInserterTest extends TestCase { fAccessor.invoke("handleKeyDown", new Object[] {event}); new DisplayHelper() { + @Override protected boolean condition() { return false; } |