summaryrefslogtreecommitdiff
path: root/unittests
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
commit598aad0fe0d99790d34390533e51e3d0e85531ef (patch)
treef107f40c5f661836791205db8444e72df6699acb /unittests
parent4c8bc8646c93899503aa9efbb92832e952c4bbec (diff)
downloadclang-598aad0fe0d99790d34390533e51e3d0e85531ef.tar.gz
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index b43f735d4c..64bb28e0be 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/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;