summaryrefslogtreecommitdiff
path: root/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
commit3d1d8197d5a0c2e9e0b9d6da0b77f375c2062b2b (patch)
tree7571d5102e8b834f5cc64c8819841fd8f09fdb3e /unittests/Format/SortImportsTestJS.cpp
parent3c9460b0d41b8e1953dca467d9d0031c1d7f3976 (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274977 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/SortImportsTestJS.cpp')
-rw-r--r--unittests/Format/SortImportsTestJS.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/unittests/Format/SortImportsTestJS.cpp b/unittests/Format/SortImportsTestJS.cpp
index 769fa793da..e6b5273f7b 100644
--- a/unittests/Format/SortImportsTestJS.cpp
+++ b/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