summaryrefslogtreecommitdiffstats
path: root/unittests/Format/SortImportsTestJava.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Format/SortImportsTestJava.cpp')
-rw-r--r--unittests/Format/SortImportsTestJava.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/unittests/Format/SortImportsTestJava.cpp b/unittests/Format/SortImportsTestJava.cpp
index 3bcf809d96..d2826a2107 100644
--- a/unittests/Format/SortImportsTestJava.cpp
+++ b/unittests/Format/SortImportsTestJava.cpp
@@ -262,6 +262,29 @@ TEST_F(SortImportsTestJava, NoNewlineAtEnd) {
"import org.a;"));
}
+TEST_F(SortImportsTestJava, ImportNamedFunction) {
+ EXPECT_EQ("import X;\n"
+ "class C {\n"
+ " void m() {\n"
+ " importFile();\n"
+ " }\n"
+ "}\n",
+ sort("import X;\n"
+ "class C {\n"
+ " void m() {\n"
+ " importFile();\n"
+ " }\n"
+ "}\n"));
+}
+
+TEST_F(SortImportsTestJava, NoReplacementsForValidImports) {
+ // Identical #includes have led to a failure with an unstable sort.
+ std::string Code = "import org.a;\n"
+ "import org.b;\n";
+ EXPECT_TRUE(
+ sortIncludes(FmtStyle, Code, GetCodeRange(Code), "input.java").empty());
+}
+
} // end namespace
} // end namespace format
} // end namespace clang