summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2017-06-23 11:46:03 +0000
committerKrasimir Georgiev <krasimir@google.com>2017-06-23 11:46:03 +0000
commitac16a201a66b036646c9d26c396ffb7bae45aa75 (patch)
treec015b033d05b05114c3e19ed88b9bed4ea4a3ceb /clang/unittests/Format/FormatTest.cpp
parent90b4ce38cb30c5ceaf8695abf7186ed81dfc6d39 (diff)
downloadbcm5719-llvm-ac16a201a66b036646c9d26c396ffb7bae45aa75.tar.gz
bcm5719-llvm-ac16a201a66b036646c9d26c396ffb7bae45aa75.zip
[clang-format] Add a SortUsingDeclaration option and enable it by default
Summary: This patch adds a `SortUsingDeclaration` style option and enables it for llvm style. Reviewers: klimek Reviewed By: klimek Subscribers: klimek Differential Revision: https://reviews.llvm.org/D34453 llvm-svn: 306094
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index b43f735d4cb..64bb28e0be2 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -9333,6 +9333,7 @@ TEST_F(FormatTest, ParsesConfigurationBools) {
CHECK_PARSE_BOOL(Cpp11BracedListStyle);
CHECK_PARSE_BOOL(ReflowComments);
CHECK_PARSE_BOOL(SortIncludes);
+ CHECK_PARSE_BOOL(SortUsingDeclarations);
CHECK_PARSE_BOOL(SpacesInParentheses);
CHECK_PARSE_BOOL(SpacesInSquareBrackets);
CHECK_PARSE_BOOL(SpacesInAngles);
@@ -10874,6 +10875,13 @@ TEST_F(ReplacementTest, SortIncludesAfterReplacement) {
EXPECT_EQ(Expected, *Result);
}
+TEST_F(FormatTest, FormatSortsUsingDeclarations) {
+ EXPECT_EQ("using std::cin;\n"
+ "using std::cout;",
+ format("using std::cout;\n"
+ "using std::cin;", getGoogleStyle()));
+}
+
TEST_F(FormatTest, UTF8CharacterLiteralCpp03) {
format::FormatStyle Style = format::getLLVMStyle();
Style.Standard = FormatStyle::LS_Cpp03;
OpenPOWER on IntegriCloud