parseParens();
} else {
while (FormatTok->isOneOf(tok::identifier, tok::coloncolon, tok::kw_inline,
- tok::l_square)) {
+ tok::l_square, tok::period)) {
if (FormatTok->is(tok::l_square))
parseSquare();
else
Style);
}
+TEST_F(FormatTestCSharp, NamespaceIndentation) {
+ FormatStyle Style = getMicrosoftStyle(FormatStyle::LK_CSharp);
+ Style.NamespaceIndentation = FormatStyle::NI_None;
+
+ verifyFormat("namespace A\n"
+ "{\n"
+ "public interface Name1\n"
+ "{\n"
+ "}\n"
+ "}\n",
+ Style);
+
+ verifyFormat("namespace A.B\n"
+ "{\n"
+ "public interface Name1\n"
+ "{\n"
+ "}\n"
+ "}\n",
+ Style);
+
+ Style.NamespaceIndentation = FormatStyle::NI_Inner;
+
+ verifyFormat("namespace A\n"
+ "{\n"
+ "namespace B\n"
+ "{\n"
+ " public interface Name1\n"
+ " {\n"
+ " }\n"
+ "}\n"
+ "}\n",
+ Style);
+
+ Style.NamespaceIndentation = FormatStyle::NI_All;
+
+ verifyFormat("namespace A.B\n"
+ "{\n"
+ " public interface Name1\n"
+ " {\n"
+ " }\n"
+ "}\n",
+ Style);
+
+ verifyFormat("namespace A\n"
+ "{\n"
+ " namespace B\n"
+ " {\n"
+ " public interface Name1\n"
+ " {\n"
+ " }\n"
+ " }\n"
+ "}\n",
+ Style);
+}
+
} // namespace format
} // end namespace clang