mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 291821 - Test case for auto-indent regression
This commit is contained in:
parent
432edada85
commit
90a3287885
1 changed files with 17 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -65,6 +65,7 @@ public class CAutoIndentTest extends AbstractAutoEditTest {
|
||||||
return new TestSuite(CAutoIndentTest.class);
|
return new TestSuite(CAutoIndentTest.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
// Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
// Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||||
|
@ -89,6 +90,7 @@ public class CAutoIndentTest extends AbstractAutoEditTest {
|
||||||
/*
|
/*
|
||||||
* @see junit.framework.TestCase#tearDown()
|
* @see junit.framework.TestCase#tearDown()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
final Plugin plugin = CUIPlugin.getDefault();
|
final Plugin plugin = CUIPlugin.getDefault();
|
||||||
if (plugin != null) {
|
if (plugin != null) {
|
||||||
|
@ -499,7 +501,20 @@ public class CAutoIndentTest extends AbstractAutoEditTest {
|
||||||
store.setToDefault(PreferenceConstants.EDITOR_SMART_TAB);
|
store.setToDefault(PreferenceConstants.EDITOR_SMART_TAB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSmartIndentAfterArrayIndexOperator_Bug291821() throws Exception {
|
||||||
|
AutoEditTester tester = createAutoEditTester();
|
||||||
|
|
||||||
|
tester.type("int &Array::operator [](int subindex)\n"); //$NON-NLS-1$
|
||||||
|
assertEquals(1, tester.getCaretLine());
|
||||||
|
tester.type('{');
|
||||||
|
// Brace is not indented
|
||||||
|
assertEquals(1, tester.getCaretColumn());
|
||||||
|
tester.type('\n');
|
||||||
|
// The brace was closed automatically.
|
||||||
|
assertEquals("}", tester.getLine(1)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
private void assertNoError() {
|
private void assertNoError() {
|
||||||
if (!fStatusLog.isEmpty()) {
|
if (!fStatusLog.isEmpty()) {
|
||||||
fail(fStatusLog.get(0).toString());
|
fail(fStatusLog.get(0).toString());
|
||||||
|
|
Loading…
Add table
Reference in a new issue