summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/SortImportsTestJS.cpp
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2016-07-09 15:11:18 +0000
committerMartin Probst <martin@probst.io>2016-07-09 15:11:18 +0000
commit2a19454a86fcd24ce7b5d5cbd76f0283737fd827 (patch)
tree7666f12e8a7c2340027cd3bf98bc402d03ca540b /clang/unittests/Format/SortImportsTestJS.cpp
parenta8c9d154b81e755e9a7181d9fded24de587b2473 (diff)
downloadbcm5719-llvm-2a19454a86fcd24ce7b5d5cbd76f0283737fd827.tar.gz
bcm5719-llvm-2a19454a86fcd24ce7b5d5cbd76f0283737fd827.zip
clang-format: [JS] Sort imports case insensitive.
Summary: ASCII case sorting does not help finding imported symbols quickly, and it is common to have e.g. class Foo and function fooFactory exported/imported from the same file. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D22146 llvm-svn: 274977
Diffstat (limited to 'clang/unittests/Format/SortImportsTestJS.cpp')
-rw-r--r--clang/unittests/Format/SortImportsTestJS.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/unittests/Format/SortImportsTestJS.cpp b/clang/unittests/Format/SortImportsTestJS.cpp
index 769fa793da3..e6b5273f7b1 100644
--- a/clang/unittests/Format/SortImportsTestJS.cpp
+++ b/clang/unittests/Format/SortImportsTestJS.cpp
@@ -240,6 +240,27 @@ TEST_F(SortImportsTestJS, TrailingComma) {
verifySort("import {A, B,} from 'aa';\n", "import {B, A,} from 'aa';\n");
}
+TEST_F(SortImportsTestJS, SortCaseInsensitive) {
+ verifySort("import {A} from 'aa';\n"
+ "import {A} from 'Ab';\n"
+ "import {A} from 'b';\n"
+ "import {A} from 'Bc';\n"
+ "\n"
+ "1;",
+ "import {A} from 'b';\n"
+ "import {A} from 'Bc';\n"
+ "import {A} from 'Ab';\n"
+ "import {A} from 'aa';\n"
+ "\n"
+ "1;");
+ verifySort("import {aa, Ab, b, Bc} from 'x';\n"
+ "\n"
+ "1;",
+ "import {b, Bc, Ab, aa} from 'x';\n"
+ "\n"
+ "1;");
+}
+
} // end namespace
} // end namespace format
} // end namespace clang
OpenPOWER on IntegriCloud