summaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-05-15 14:09:55 +0000
committerDaniel Jasper <djasper@google.com>2013-05-15 14:09:55 +0000
commit5be59ba8c9fb291f83970f0ebddceda70088bb28 (patch)
tree9e543f881c4267b04c967ec25df631424ad959fe /unittests/Format/FormatTest.cpp
parent5d823e3a00a3e21a0823288e6dee26a93758332b (diff)
downloadclang-5be59ba8c9fb291f83970f0ebddceda70088bb28.tar.gz
clang-5be59ba8c9fb291f83970f0ebddceda70088bb28.tar.bz2
clang-5be59ba8c9fb291f83970f0ebddceda70088bb28.tar.xz
Don't put short namespace on a single line.
Before: namespace abc { class SomeClass; } namespace def { void someFunction() {} } After: namespace abc { class Def; } namespace def { void someFunction() {} } Rationale: a) Having anything other than forward declaration on the same line as a namespace looks confusing. b) Formatting namespace-forward-declaration-combinations different from other stuff is inconsistent. c) Wasting vertical space close to such forward declarations really does not affect readability. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181887 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r--unittests/Format/FormatTest.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 499388e6ba..58dbffd863 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -745,11 +745,11 @@ TEST_F(FormatTest, SplitsLongCxxComments) {
}
TEST_F(FormatTest, ParsesCommentsAdjacentToPPDirectives) {
- EXPECT_EQ("namespace {}\n// Test\n#define A",
+ EXPECT_EQ("namespace {\n}\n// Test\n#define A",
format("namespace {}\n // Test\n#define A"));
- EXPECT_EQ("namespace {}\n/* Test */\n#define A",
+ EXPECT_EQ("namespace {\n}\n/* Test */\n#define A",
format("namespace {}\n /* Test */\n#define A"));
- EXPECT_EQ("namespace {}\n/* Test */ #define A",
+ EXPECT_EQ("namespace {\n}\n/* Test */ #define A",
format("namespace {}\n /* Test */ #define A"));
}
@@ -2921,7 +2921,10 @@ TEST_F(FormatTest, IncorrectCodeMissingSemicolon) {
" return\n"
"}",
format("void f ( ) { if ( a ) return }"));
- EXPECT_EQ("namespace N { void f() }", format("namespace N { void f() }"));
+ EXPECT_EQ("namespace N {\n"
+ "void f()\n"
+ "}",
+ format("namespace N { void f() }"));
EXPECT_EQ("namespace N {\n"
"void f() {}\n"
"void g()\n"