summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2016-09-02 14:06:32 +0000
committerMartin Probst <martin@probst.io>2016-09-02 14:06:32 +0000
commit6918dcafe8ea256ae1ff0b51a95d4a5d076cd380 (patch)
tree1c1ea5c67fecf9e98e3ba8e91044740c3ccb372b /clang/unittests/Format
parentb480ffbcef2e0833b471d304861e20c2d6d9e963 (diff)
downloadbcm5719-llvm-6918dcafe8ea256ae1ff0b51a95d4a5d076cd380.tar.gz
bcm5719-llvm-6918dcafe8ea256ae1ff0b51a95d4a5d076cd380.zip
clang-format: [JS] handle default bindings in imports.
Summary: Default imports appear outside of named bindings in curly braces: import A from 'a'; import A, {symbol} from 'a'; Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D23973 llvm-svn: 280486
Diffstat (limited to 'clang/unittests/Format')
-rw-r--r--clang/unittests/Format/SortImportsTestJS.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/unittests/Format/SortImportsTestJS.cpp b/clang/unittests/Format/SortImportsTestJS.cpp
index e43844c49cb..2bb35a2de08 100644
--- a/clang/unittests/Format/SortImportsTestJS.cpp
+++ b/clang/unittests/Format/SortImportsTestJS.cpp
@@ -70,6 +70,26 @@ TEST_F(SortImportsTestJS, BasicSorting) {
"let x = 1;");
}
+TEST_F(SortImportsTestJS, DefaultBinding) {
+ verifySort("import A from 'a';\n"
+ "import B from 'b';\n"
+ "\n"
+ "let x = 1;",
+ "import B from 'b';\n"
+ "import A from 'a';\n"
+ "let x = 1;");
+}
+
+TEST_F(SortImportsTestJS, DefaultAndNamedBinding) {
+ verifySort("import A, {a} from 'a';\n"
+ "import B, {b} from 'b';\n"
+ "\n"
+ "let x = 1;",
+ "import B, {b} from 'b';\n"
+ "import A, {a} from 'a';\n"
+ "let x = 1;");
+}
+
TEST_F(SortImportsTestJS, WrappedImportStatements) {
verifySort("import {sym1, sym2} from 'a';\n"
"import {sym} from 'b';\n"
OpenPOWER on IntegriCloud