forked from qt-creator/qt-creator
C++: Do not auto-insert '}' after control flow constructs
...as this rather gets in the way.
As before, pressing ENTER after { will still auto insert } on the next
line.
Fixes: QTCREATORBUG-18872
Change-Id: I8ee082962b5ee82781e51c3e5ee146343f808332
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
@@ -221,6 +221,41 @@ TEST_F(MatchingText, ContextAllowsAutoParentheses_CurlyBrace_NotInTheMiddle)
|
||||
ASSERT_FALSE(MT::contextAllowsAutoParentheses(document.cursor, "{"));
|
||||
}
|
||||
|
||||
TEST_F(MatchingText, ContextAllowsAutoParentheses_CurlyBrace_NotAfterControlFlow_WhileAndFriends)
|
||||
{
|
||||
const Document document("while (true) @");
|
||||
|
||||
ASSERT_FALSE(MT::contextAllowsAutoParentheses(document.cursor, "{"));
|
||||
}
|
||||
|
||||
TEST_F(MatchingText, ContextAllowsAutoParentheses_CurlyBrace_NotAfterControlFlow_DoAndFriends)
|
||||
{
|
||||
const Document document("do @");
|
||||
|
||||
ASSERT_FALSE(MT::contextAllowsAutoParentheses(document.cursor, "{"));
|
||||
}
|
||||
|
||||
TEST_F(MatchingText, ContextAllowsAutoParentheses_CurlyBrace_InvalidCode_UnbalancedParens)
|
||||
{
|
||||
const Document document(") @");
|
||||
|
||||
ASSERT_TRUE(MT::contextAllowsAutoParentheses(document.cursor, "{"));
|
||||
}
|
||||
|
||||
TEST_F(MatchingText, ContextAllowsAutoParentheses_CurlyBrace_InvalidCode_UnbalancedParens2)
|
||||
{
|
||||
const Document document("while true) @");
|
||||
|
||||
ASSERT_TRUE(MT::contextAllowsAutoParentheses(document.cursor, "{"));
|
||||
}
|
||||
|
||||
TEST_F(MatchingText, ContextAllowsAutoParentheses_CurlyBrace_InvalidCode_OnlyBalancedParens)
|
||||
{
|
||||
const Document document("() @");
|
||||
|
||||
ASSERT_TRUE(MT::contextAllowsAutoParentheses(document.cursor, "{"));
|
||||
}
|
||||
|
||||
TEST_F(MatchingText, ContextAllowsAutoParentheses_CurlyBrace_NotBeforeNamedNamespace)
|
||||
{
|
||||
const Document document("namespace X @");
|
||||
|
||||
Reference in New Issue
Block a user